/* ============================================================
   MKS DTECH - portal theme
   Same visual language as the MKS website (MKS-Website/app/globals.css)
   and the current customer portal (MKS-Portal/src/index.css):
   light-grey background with a faint blueprint grid, near-black text,
   MKS blue (#1DB7F1) accent, hairline borders, soft cards, mono eyebrows.
   Loaded after Bootstrap and the legacy stylesheets, so it restyles
   every page (Bootstrap classes included) without touching markup.
   ============================================================ */

:root {
    /* surfaces */
    --bg: #f7f9fb;
    --bg-2: #eef0f3;
    --bg-alt: #fafbfc;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-2: rgba(255, 255, 255, 0.92);
    /* White and cyan (2026-11-25): one light border on cards, a slightly stronger one on fields and white buttons,
       hairlines inside */
    --border: #e8ebef;
    --border-2: #dfe3e8;
    --divider: #eef0f3;
    --row-line: #f0f2f5;
    --ink: #0b1620;

    /* text */
    --text: #101828;
    --text-dim: #344054;
    --text-faint: #667085;
    --text-ghost: #98a2b3;
    --text-label: #475467;

    /* brand */
    --mks-blue: #1DB7F1;
    --mks-blue-dim: rgba(29, 183, 241, 0.70);
    /* Two blues for the whole portal, customer and admin. MKS blue (as on the MKS website) for the main buttons, the
       logo, active tabs and menu items, focus rings, dots. The darker one for text that is read (links, tags). */
    --accent: #0077a8;
    --accent-ink: #005f86;
    --primary: #1DB7F1;
    --primary-hover: #0ea5d9;
    --cyan-tint: #eaf7fd;
    --cyan-ink: #00668f;
    --ring: 0 0 0 3px rgba(29, 183, 241, 0.18);
    --accent-soft: rgba(29, 183, 241, 0.10);
    --accent-line: rgba(29, 183, 241, 0.24);

    /* status */
    --ok-bg: #ecfdf3; --ok-fg: #027a48; --ok-dot: #12b76a;
    --info-bg: #e8f6fd; --info-fg: var(--mks-blue);
    --warn-bg: #fff4e5; --warn-fg: #8a4b0a; --warn-dot: #d9822b;
    --danger-bg: #fdecec; --danger-fg: #b42318; --danger-fg2: #912018; --danger-dot: #d92d20;
    --trial-bg: #f3eefe; --trial-fg: #5b21b6; --trial-dot: #7c3aed;

    /* type */
    --sans: "Inter", -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
    --mono: "SF Mono", ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    --radius: 14px;
    /* Cards: a light border and a little shadow; fields and white buttons: none */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px -10px rgba(16, 24, 40, 0.12);
    --shadow-primary: 0 1px 2px rgba(29, 183, 241, 0.25), 0 4px 10px -4px rgba(29, 183, 241, 0.45);
    --shadow-danger: 0 1px 2px rgba(217, 45, 32, 0.25), 0 4px 10px -4px rgba(217, 45, 32, 0.40);

    /* Bootstrap hooks */
    --bs-primary: #1DB7F1;
    --bs-primary-rgb: 29, 183, 241;
    --bs-body-font-family: var(--sans);
    --bs-body-color: var(--text);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--mks-blue);
    --bs-border-color: var(--border-2);

    /* legacy portal variables, mapped onto the theme */
    --main-background: transparent;
    --font-main: var(--sans);
    --font-medium: var(--sans);
    --font-bold: var(--sans);
    --font-color-text: var(--text);
    --font-color-label: var(--text-faint);
    --font-color-blue: var(--mks-blue);
    --border-color: var(--border-2);
    --border-color-active: var(--mks-blue);

    /* Colours that were written out in the rules below, named so the admin's dark theme can change them */
    --card: #fff;
    --bg-sunken: #f6f7f9;
    --hover-bg: #f9fafb;
    --hover-tint: rgba(0, 0, 0, .045);
    --chip-bg: #f0f2f5;
    --border-hover: #d0d5dd;
    --border-strong: rgba(0, 0, 0, .22);
    --text-strong: #1d2939;
    --nav-active-bg: #eef7fc;
    --nav-active-fg: #00577d;
    --switch-off: #d4d4da;
    --dot-off: #c4cbd4;
    --tag-bg: #f1f1f4;
    --tag-dot: #9a9aa2;
    --skeleton-a: #ebebee;
    --skeleton-b: #f5f5f7;
    --chart-grid: #eef0f2;
    --chart-zero: #c9ced4;
    --wordmark-ink: #111;
    --scroll-thumb: rgba(0, 0, 0, .22);
    --reconnect-veil: rgba(245, 245, 247, .72);
    --admin-badge-bg: #0b0f14;
    --admin-badge-fg: #fff;
    --danger-line: #f4c7c3;
    --pin: #0b4f6c;
    --pinned-bg: #f3f9fc;
    --ok-text: #15803d;
    --warn-text: #c2410c;
    --danger-text: #dc2626;
    /* badges (type, role, cycle, plan chips): a tint and its ink */
    --b-indigo-bg: #eef2ff; --b-indigo-fg: #4f46e5;
    --b-green-bg: #e7f6ec;  --b-green-fg: #157f3c;
    --b-teal-bg: #e6f6f3;   --b-teal-fg: #0f766e;
    --b-amber-bg: #fdf3e1;  --b-amber-fg: #a86b00;
    --b-pink-bg: #fdeef4;   --b-pink-fg: #be185d;
    --b-purple-bg: #f3e8ff; --b-purple-fg: #7e22ce;
    --b-orange-bg: #ffedd5; --b-orange-fg: #9a3412;
}

/* ============================================================
   Dark theme. People pick System, Light or Dark in the account menu or Account settings
   (Components/Controls/ThemeSwitch.razor); the script in App.razor puts data-theme="dark" (and Bootstrap's
   data-bs-theme="dark") on <html> before the first paint, only while the signed-in app is on screen: the sign-in,
   checkout, product and invitation pages stay light.
   ============================================================ */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0d1117;
    --bg-2: #1b2129;
    --bg-alt: #161c24;
    --surface: rgba(21, 26, 33, 0.7);
    --surface-2: rgba(21, 26, 33, 0.92);
    --card: #151a21;
    --bg-sunken: #1a2029;
    --border: #262d37;
    --border-2: #313945;
    --border-hover: #404957;
    --border-strong: rgba(255, 255, 255, .24);
    --divider: #232a33;
    --row-line: #1e252e;
    --ink: #f0f3f6;

    --text: #e6e9ee;
    --text-dim: #c2c8d1;
    --text-faint: #8f98a5;
    --text-ghost: #6c7582;
    --text-label: #a7afba;
    --text-strong: #e6e9ee;

    --accent: #52c5f3;
    --accent-ink: #84d5f6;
    --cyan-tint: rgba(29, 183, 241, 0.15);
    --cyan-ink: #84d5f6;
    --accent-soft: rgba(29, 183, 241, 0.16);
    --accent-line: rgba(29, 183, 241, 0.40);
    --ring: 0 0 0 3px rgba(29, 183, 241, 0.30);

    --ok-bg: rgba(18, 183, 106, 0.14); --ok-fg: #5fd39a; --ok-dot: #22c57a;
    --info-bg: rgba(29, 183, 241, 0.12);
    --warn-bg: rgba(217, 130, 43, 0.16); --warn-fg: #f2b56d; --warn-dot: #e5953f;
    --danger-bg: rgba(217, 45, 32, 0.16); --danger-fg: #f97066; --danger-fg2: #fda29b; --danger-dot: #e5483d;
    --trial-bg: rgba(124, 58, 237, 0.20); --trial-fg: #c4b5fd; --trial-dot: #9f7aea;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-primary: 0 1px 2px rgba(29, 183, 241, 0.25), 0 4px 10px -4px rgba(29, 183, 241, 0.35);
    --shadow-danger: 0 1px 2px rgba(217, 45, 32, 0.25), 0 4px 10px -4px rgba(217, 45, 32, 0.35);

    --hover-bg: #1c232c;
    --hover-tint: rgba(255, 255, 255, .06);
    --chip-bg: #232a34;
    --nav-active-bg: rgba(29, 183, 241, 0.14);
    --nav-active-fg: #84d5f6;
    --switch-off: #3b434f;
    --dot-off: #4c5561;
    --tag-bg: #232a34;
    --tag-dot: #6c7582;
    --skeleton-a: #1d232c;
    --skeleton-b: #29303a;
    --chart-grid: #222932;
    --chart-zero: #4c5561;
    --wordmark-ink: #e6e9ee;
    --scroll-thumb: rgba(255, 255, 255, .20);
    --reconnect-veil: rgba(13, 17, 23, .72);
    --admin-badge-bg: #e6e9ee;
    --admin-badge-fg: #0d1117;
    --danger-line: rgba(249, 112, 102, .40);
    --pin: #5cc2ea;
    --pinned-bg: rgba(29, 183, 241, .08);
    --ok-text: #4ade80;
    --warn-text: #fb923c;
    --danger-text: #f87171;
    --b-indigo-bg: rgba(99, 102, 241, .20);  --b-indigo-fg: #a5b4fc;
    --b-green-bg: rgba(34, 197, 94, .16);    --b-green-fg: #6ee7a0;
    --b-teal-bg: rgba(20, 184, 166, .16);    --b-teal-fg: #5eead4;
    --b-amber-bg: rgba(245, 158, 11, .17);   --b-amber-fg: #fcd34d;
    --b-pink-bg: rgba(236, 72, 153, .17);    --b-pink-fg: #f9a8d4;
    --b-purple-bg: rgba(168, 85, 247, .19);  --b-purple-fg: #d8b4fe;
    --b-orange-bg: rgba(249, 115, 22, .17);  --b-orange-fg: #fdba74;

    /* Bootstrap (its own dark set comes from data-bs-theme="dark"; these keep it on the theme's surfaces) */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-secondary-bg: var(--bg-2);
    --bs-tertiary-bg: var(--bg-alt);
    --bs-secondary-color: var(--text-faint);
    --bs-emphasis-color: var(--ink);
    --bs-border-color: var(--border-2);
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 82, 197, 243;
    --bs-link-hover-color: var(--accent-ink);

    /* legacy variables (variables.css) */
    --main-background: transparent;
    --font-color-text: var(--text);
    --font-color-black: var(--ink);
    --gray-100: var(--bg-2);
    --gray-900: var(--text);
    --color-warning-bg: var(--warn-bg);
    --color-error-bg: var(--danger-bg);
    --color-prompt-bg: var(--info-bg);
    --scrollbar-bg-color: var(--bg);
    --scrollbar-border-color: var(--bg);
}
/* Bootstrap components that draw their own white or light grey */
html[data-theme="dark"] .dropdown-menu { --bs-dropdown-bg: var(--card); --bs-dropdown-border-color: var(--border-2); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--hover-bg); --bs-dropdown-link-hover-color: var(--ink); --bs-dropdown-divider-bg: var(--border); }
html[data-theme="dark"] .modal-content { --bs-modal-bg: var(--card); --bs-modal-color: var(--text); --bs-modal-border-color: var(--border); --bs-modal-header-border-color: var(--border); --bs-modal-footer-border-color: var(--border); }
html[data-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--divider); --bs-table-striped-bg: var(--hover-tint); --bs-table-hover-bg: var(--hover-tint); --bs-table-hover-color: var(--text); }
html[data-theme="dark"] .list-group { --bs-list-group-bg: var(--card); --bs-list-group-color: var(--text); --bs-list-group-border-color: var(--border); }
html[data-theme="dark"] .card { --bs-card-bg: var(--card); --bs-card-border-color: var(--border); --bs-card-cap-bg: var(--bg-sunken); }
html[data-theme="dark"] .form-control, html[data-theme="dark"] .form-select { background-color: var(--card); color: var(--text); border-color: var(--border-2); }
html[data-theme="dark"] .form-control::placeholder { color: var(--text-ghost); }
html[data-theme="dark"] .form-control:disabled, html[data-theme="dark"] .form-control[readonly] { background-color: var(--bg-2); }
html[data-theme="dark"] .modal-backdrop.show { background-color: #000; opacity: .55; }
html[data-theme="dark"] .bg-white, html[data-theme="dark"] .bg-light { background-color: var(--card) !important; }
html[data-theme="dark"] .text-dark, html[data-theme="dark"] .text-black { color: var(--text) !important; }
html[data-theme="dark"] .text-muted, html[data-theme="dark"] .text-secondary { color: var(--text-faint) !important; }
html[data-theme="dark"] .border, html[data-theme="dark"] .border-top, html[data-theme="dark"] .border-bottom { border-color: var(--border) !important; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--text); }

/* ============================================================
   Admin: the same system, plainer. Same blue and buttons, 10px cards without shadows, a smaller title,
   denser tables.
   ============================================================ */
.app-shell.admin { --radius: 12px; }
.app-shell.admin .card, .app-shell.admin .stat-tile, .app-shell.admin .app-card, .app-shell.admin .org-card,
.app-shell.admin .product-tile { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.app-shell.admin .page-title { font-size: 21px; letter-spacing: -0.02em; line-height: 1.3; }
.app-shell.admin .view-tab { padding: 7px 12px 9px; }
.app-shell.admin .data-table > thead th { padding: 9px 12px; }
.app-shell.admin .data-table > tbody td { padding: 10px 12px; }
.app-shell.admin .data-table > thead th:first-child, .app-shell.admin .data-table > tbody td:first-child { padding-left: 16px; }
body:has(.app-shell.admin) { background: var(--bg); }
/* Admin text is 14px, as in the design; older admin pages title themselves with a Bootstrap h2 and their cards with h4,
   brought to the sizes of the newer pages. */
.app-shell.admin .app-main { font-size: 14px; }
.app-shell.admin h2.mb-0, .app-shell.admin h2.mb-3 { font-size: 20px; letter-spacing: -0.01em; line-height: 1.25; }
.app-shell.admin .card h4 { font-size: 15px; letter-spacing: -0.01em; line-height: 1.6; margin-bottom: 10px; }
.app-shell.admin .card h4.mb-0 { margin-bottom: 0; }

h1, h2, h3, h4, h5 {
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.015em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
a:not(.btn):hover { text-decoration: underline; }

/* ============================================================
   Page header: mono eyebrow + big tight title + subtitle
   ============================================================ */
.page-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: clamp(20px, 3vw, 32px); }
.page-eyebrow, .eyebrow {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-faint);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
/* The eyebrow as the way back to what the page belongs to ("← Team name"). */
.page-eyebrow.back { align-self: flex-start; text-decoration: none !important; color: var(--accent); }
.page-eyebrow.back .material-symbols-outlined { font-size: 15px; transition: transform .15s; }
.page-eyebrow.back:hover .material-symbols-outlined { transform: translateX(-2px); }
/* Rhino Sync's account title size, shared with BEAM's account */
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.33; margin: 0; color: var(--ink); }
.page-sub { font-size: clamp(15px, 1.6vw, 17px); color: var(--text-faint); max-width: 46em; margin: 0; }

/* ============================================================
   Buttons (Bootstrap classes restyled)
   ============================================================ */
/* Buttons: pills, 36px high (32px small). The main one MKS blue with white text and a soft blue shadow, the others
   white with a light border; red only for what deletes or can't be undone. */
.btn {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    line-height: 20px;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn-sm { font-size: 13.5px; line-height: 18px; padding: 6px 13px; border-radius: 999px; }
.btn-lg { font-size: 15px; padding: 9px 20px; }
.btn:disabled, .btn.disabled { opacity: 0.55; }

.btn-primary, .btn-primary:focus, .btn-primary:disabled {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover:not(:disabled), .btn-primary:active {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: #fff !important;
}
.btn-primary:disabled { box-shadow: none; }

.btn-outline-primary, .btn-outline-secondary, .btn-outline-dark, .btn-light, .btn-secondary {
    background: var(--card);
    color: var(--text-strong);
    border-color: var(--border-2);
    box-shadow: none;
}
.btn-outline-primary:hover:not(:disabled), .btn-outline-secondary:hover:not(:disabled), .btn-outline-dark:hover:not(:disabled),
.btn-light:hover:not(:disabled), .btn-secondary:hover:not(:disabled) {
    background: var(--hover-bg);
    color: var(--ink);
    border-color: var(--border-hover);
    box-shadow: none;
}

.btn-danger, .btn-danger:focus, .btn-danger:disabled { background: var(--danger-dot); border-color: var(--danger-dot); color: #fff; box-shadow: var(--shadow-danger); }
.btn-danger:hover:not(:disabled), .btn-danger:active { background: var(--danger-fg) !important; border-color: var(--danger-fg) !important; color: #fff !important; }
.btn-danger:disabled { box-shadow: none; }
/* A text-only action in a row or a footer: "Change", "Delete" */
.btn-text { padding-left: 4px; padding-right: 4px; background: transparent; border-color: transparent; color: var(--accent); }
.btn-text:hover:not(:disabled) { color: var(--accent-ink); text-decoration: underline; }
.btn-text.danger { color: var(--danger-fg); }
.btn-text.danger:hover:not(:disabled) { color: var(--danger-fg2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-outline-danger { background: var(--card); color: var(--danger-fg); border-color: var(--danger-line); box-shadow: none; }
.btn-outline-danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-fg2); border-color: var(--danger-line); }

.btn-link { color: var(--accent); text-decoration: none; padding-inline: 0; }
.btn-link:hover { color: var(--accent-ink); text-decoration: underline; }

.btn:focus-visible { box-shadow: var(--ring) !important; }

/* ============================================================
   Form fields
   ============================================================ */
.form-label { font-size: 13px; font-weight: 500; color: var(--text-dim); letter-spacing: -0.005em; margin-bottom: 6px; }
.form-control, .form-select {
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
    background-color: var(--card);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    padding: 7px 12px;
    line-height: 20px;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:active { box-shadow: none; }
textarea.form-control { padding-top: 9px; padding-bottom: 9px; }
.form-control::placeholder { color: var(--text-ghost); }
.form-control:focus, .form-select:focus {
    border-color: var(--mks-blue);
    box-shadow: var(--ring);
}
.form-control:disabled, .form-control[readonly] { background-color: var(--bg); color: var(--text-faint); border-color: var(--border); }
.form-control.is-invalid, .form-control[aria-invalid="true"], .form-select.is-invalid { border-color: var(--danger-dot); background-image: none; padding-right: 12px; }
.form-control.is-invalid:focus, .form-control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.15); }
.field-error, .invalid-feedback { font-size: 12.5px; color: var(--danger-fg) !important; }
.mono, .form-control.mono { font-family: var(--mono); font-size: 13px; }
/* Dropdowns: one look everywhere. Room on the right for a thin chevron; long options end in "…", never under it. */
.form-select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 38px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a8f98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 14px 14px;
}
.form-select:hover:not(:disabled) { border-color: var(--border-strong); }
.form-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231DB7F1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
.form-select:disabled { background-color: var(--bg); color: var(--text-faint); cursor: default; }
.form-select-sm { padding: 5px 32px 5px 12px; font-size: 13.5px; border-radius: 999px; background-position: right 10px center; }
/* The site's dropdown (Components/Controls/Select.razor): looks like a field, opens a menu we draw. */
.mks-select { position: relative; display: inline-block; width: 100%; }
.mks-select-button {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 7px 12px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--card);
    font-family: var(--sans); font-size: 14px; color: var(--text); text-align: left; cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.mks-select-button:hover:not(:disabled) { border-color: var(--border-strong); }
.mks-select-button:focus-visible, .mks-select.open .mks-select-button { outline: none; border-color: var(--mks-blue); box-shadow: var(--ring); }
.mks-select-button:disabled { background: var(--bg); color: var(--text-faint); cursor: default; }
.mks-select-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mks-select-value.is-placeholder { color: var(--text-ghost); }
.mks-select-chevron { flex-shrink: 0; font-size: 18px; color: var(--text-faint); transition: transform .15s; }
.mks-select.open .mks-select-chevron { transform: rotate(180deg); color: var(--mks-blue); }
.mks-select.sm .mks-select-button { padding: 5px 10px 5px 12px; font-size: 13.5px; border-radius: 999px; }
/* Small controls side by side in a toolbar (buttons, a button group, a select) are one height */
.btn-sm, .btn-group-sm > .btn, .mks-select.sm .mks-select-button, .form-select-sm { height: 34px; padding-top: 0; padding-bottom: 0; box-sizing: border-box; }
.btn-group-sm > .btn { font-size: 13.5px; line-height: 18px; padding-left: 13px; padding-right: 13px; }
/* Over a list (filters, a row's role): pills, as the search box beside them */
.list-toolbar .mks-select-button, .data-table .mks-select-button { border-radius: 999px; padding-left: 14px; }

.mks-select-backdrop { position: fixed; inset: 0; z-index: 1050; }
.mks-select-menu {
    position: fixed; z-index: 1051; margin: 0; padding: 4px; list-style: none;
    max-height: 300px; overflow-y: auto; max-width: min(360px, calc(100vw - 16px));
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
    animation: mks-select-in .12s ease-out;
}
@keyframes mks-select-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.mks-select-option { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; font-size: 14px; color: var(--text); cursor: pointer; }
.mks-select-option.active { background: var(--hover-bg); }
.mks-select-option.selected { background: var(--cyan-tint); color: var(--cyan-ink); font-weight: 500; }
.mks-select-option.disabled { color: var(--text-ghost); cursor: default; }
.mks-select-option-text { flex: 1; min-width: 0; display: grid; }
.mks-select-option-text small { font-size: 12px; font-weight: 400; color: var(--text-faint); }
.mks-select-check { flex-shrink: 0; font-size: 18px; color: var(--mks-blue); }

.form-text { font-size: 12.5px; color: var(--text-faint); }
.form-check-input { accent-color: var(--primary); }
.form-check-input:checked { background-color: var(--mks-blue); border-color: var(--mks-blue); }
.form-check-input:focus { border-color: var(--mks-blue); box-shadow: var(--ring); }
/* Switches: a 36 x 20 track, white knob, MKS blue when on (in the admin too) (Bootstrap's form-switch and Components/Controls/Switch.razor) */
.form-switch .form-check-input {
    width: 36px; height: 20px; margin-top: 0; border: 0; border-radius: 999px; cursor: pointer;
    background-color: var(--switch-off);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3.2' fill='%23fff'/%3e%3c/svg%3e") !important;
    transition: background-color .15s, background-position .15s;
}
.form-switch .form-check-input:checked { background-color: var(--mks-blue); }
.form-switch .form-check-input:focus { box-shadow: var(--ring); }
.setting-control .form-switch .form-check-input { width: 36px; height: 20px; }
.mks-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; margin: 0; }
.mks-switch-track { position: relative; flex-shrink: 0; width: 36px; height: 20px; padding: 0; border: 0; border-radius: 999px; background: var(--switch-off); cursor: pointer; transition: background .15s; }
.mks-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.mks-switch-track[aria-checked="true"] { background: var(--primary); }
.mks-switch-track[aria-checked="true"]::after { left: 18px; }
.mks-switch-track:focus-visible { outline: none; box-shadow: var(--ring); }
.mks-switch-track:disabled { opacity: .5; cursor: default; }

/* ============================================================
   Cards, badges, alerts, tables
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.card.border-danger { border-color: rgba(220, 38, 38, .25) !important; }

.card-eyebrow {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-faint);
    margin: 0;
}

.badge {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
}
.badge.bg-success { background: var(--ok-bg) !important; color: var(--ok-fg); }
.badge.bg-secondary { background: var(--bg-2) !important; color: var(--text-faint); }
.badge.bg-primary, .badge.bg-info { background: var(--info-bg) !important; color: var(--info-fg); }
.badge.bg-warning { background: var(--warn-bg) !important; color: var(--warn-fg) !important; }

.alert { border-radius: 10px; border: 0; font-size: 13.5px; line-height: 1.45; padding: 10px 14px; }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); }
.alert-danger { background: var(--danger-bg); color: var(--danger-fg); }
.alert-info { background: var(--info-bg); color: var(--info-fg); }
.alert-warning { background: var(--warn-bg); color: var(--warn-fg); }
/* Components/Controls/Notice.razor: the same colours with an icon in front */
.notice { display: flex; align-items: flex-start; gap: 10px; }
.notice > .material-symbols-outlined { flex-shrink: 0; font-size: 18px; line-height: 1.1; }
.notice-text { flex: 1; min-width: 0; }

/* Tags: what kind or state something is, a dot then a word (Components/Controls/Tag.razor) */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; vertical-align: 1px; background: var(--tag-bg); color: var(--text-dim); }
.tag-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--tag-dot); }
.tag.blue { background: var(--cyan-tint); color: var(--cyan-ink); }
.tag.blue .tag-dot { background: var(--mks-blue); }
.tag.green { background: var(--ok-bg); color: var(--ok-fg); }
.tag.green .tag-dot { background: var(--ok-dot); }
.tag.purple { background: var(--cyan-tint); color: var(--cyan-ink); }
.tag.purple .tag-dot { background: var(--mks-blue); }
.tag.amber { background: var(--warn-bg); color: var(--warn-fg); }
.tag.amber .tag-dot { background: var(--warn-dot); }
.tag.red { background: var(--danger-bg); color: var(--danger-fg); }
.tag.red .tag-dot { background: var(--danger-dot); }
/* A tag with its dot is a state: drawn as one (dot and word, no pill); a trial is MKS blue as on the customer side */
.tag.has-dot .tag-dot { width: 7px; height: 7px; }
.tag.has-dot:not(.red) { color: var(--text-label); }
.tag.has-dot:not(.green):not(.blue):not(.purple):not(.amber):not(.red) { color: var(--text-faint); }
.tag.has-dot:not(.green):not(.blue):not(.purple):not(.amber):not(.red) .tag-dot { background: var(--dot-off); }
.tag.code { border-radius: 6px; font-family: var(--mono); font-size: 11.5px; }

/* Filter chips over a list: one or more pressed */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filter { border: 1px solid var(--border-2); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; background: var(--card); color: var(--text-dim); cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.chip-filter:hover { border-color: var(--border-strong); color: var(--text); }
.chip-filter[aria-pressed="true"], .chip-filter.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
.chip-filter:focus-visible { outline: none; box-shadow: var(--ring); }

/* A short label on hover or focus: <span data-tip="..."> */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 1060;
    padding: 6px 10px; border-radius: 7px; background: #111114; color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.3; white-space: nowrap; pointer-events: none;
}

/* Placeholder lines while something loads */
.skeleton { display: grid; gap: 10px; }
.skeleton span { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--skeleton-a) 0%, var(--skeleton-b) 50%, var(--skeleton-a) 100%); background-size: 200% 100%; animation: mks-skeleton 1.2s ease-in-out infinite; }
@keyframes mks-skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton span { animation: none; } }

/* A page loading (PageLoading): tiles or a panel of rows that shimmer, fading in after a beat so quick loads don't flash */
.page-loading { display: grid; gap: 14px; margin-top: 4px; opacity: 0; animation: mks-loading-in .3s ease-out .15s forwards; }
.page-loading .bone { display: block; border-radius: 7px; background: linear-gradient(90deg, var(--skeleton-a) 0%, var(--skeleton-b) 50%, var(--skeleton-a) 100%); background-size: 200% 100%; animation: mks-skeleton 1.3s ease-in-out infinite; }
.page-loading .bone.line { height: 12px; }
.page-loading .bone.line.thin { height: 9px; }
.page-loading .bone.line.title { width: 120px; height: 15px; margin-top: 8px; }
.page-loading .bone.logo { width: 40px; height: 40px; flex: none; border-radius: 50%; }
.page-loading-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.page-loading-tile, .page-loading-card { display: grid; gap: 12px; align-content: start; padding: 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.page-loading-tile { opacity: 0; animation: mks-loading-in .35s ease-out forwards; }
.page-loading-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.page-loading-lines { flex: 1; display: grid; gap: 7px; }
.page-loading-card { gap: 16px; padding: 22px; }
.page-loading-row { display: flex; justify-content: space-between; gap: 24px; padding-top: 14px; border-top: 1px solid var(--border); }
@keyframes mks-loading-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page-loading, .page-loading-tile { animation: none; opacity: 1; } .page-loading .bone { animation: none; } }

.table { --bs-table-bg: transparent; color: var(--text); }
/* Tables: plain white headers in small grey type, hairlines between rows */
.table > thead th {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-faint);
    background: var(--card);
    border-bottom: 1px solid var(--divider);
}
.table > tbody td { border-color: var(--row-line); }
.table > tbody tr:hover > * { background: var(--bg-alt); }

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.18);
    padding: 6px;
}
.dropdown-item { border-radius: 8px; font-size: 14px; padding: 7px 12px; text-decoration: none; }
.dropdown-item:hover, .dropdown-item:focus, a.dropdown-item:not(.btn):hover, a.dropdown-item:not(.btn):focus { text-decoration: none; }
.dropdown-item:active { background: var(--accent-soft); color: var(--text); }

/* ============================================================
   Settings pages: section title + explanation on the left,
   controls on the right, hairline between sections
   ============================================================ */
.settings-card { padding: 0 !important; overflow: hidden; margin-bottom: 24px; }
.settings-section {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) 2fr;
    gap: 24px 40px;
    padding: clamp(20px, 2.6vw, 30px);
    border-top: 1px solid var(--border);
}
.settings-section:first-child { border-top: none; }
.settings-intro h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 6px; }
.settings-intro p { font-size: 13.5px; color: var(--text-faint); margin: 0; line-height: 1.5; }
.settings-body { display: grid; gap: 14px; align-content: start; min-width: 0; }
.settings-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.settings-danger .settings-intro h2 { color: var(--danger-fg); }
@media (max-width: 760px) { .settings-section { grid-template-columns: 1fr; } }
/* Account page (Pages/User/Account.razor): one row per thing, its name on the left, the value, then its button;
   a form opens under the row when its button is pressed. */
.account-tabs { margin-bottom: 20px; }
.account-view { display: grid; gap: 16px; align-content: start; max-width: 820px; }
.account-card { padding: 0 !important; overflow: hidden; }
.account-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 18px 22px; border-top: 1px solid var(--border); }
.account-row:first-child { border-top: 0; }
.account-label { flex: 0 0 180px; font-weight: 600; }
.account-value { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.account-name { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-row:has(.account-name) { align-items: end; }
.account-row:has(.account-name) > .account-label { align-self: center; }
.account-action { flex-shrink: 0; }
.account-form { flex: 1 0 100%; display: grid; gap: 14px; max-width: 560px; margin-left: 204px; }
.account-danger { border-color: rgba(220, 38, 38, .22); }
.account-danger .account-label { color: var(--danger-fg); }
.account-row .method-name { display: inline-flex; align-items: center; gap: 10px; }
@media (max-width: 760px) {
    .account-label { flex-basis: 100%; }
    .account-name { grid-template-columns: 1fr; }
    .account-form { margin-left: 0; }
}
/* Admin side menu: a heading over the product pages */
.side-nav-group { margin: 12px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-faint); }


.value-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 14.5px;
    color: var(--text);
    max-width: 100%;
}

.method-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}
.method-row .method-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
/* ---------- states: one look everywhere ----------
   Whatever state something is in (Active, Trial, Connected, Not connected, Verified, Renew by…, Payment problem,
   Expired), it is a small coloured dot then the word, 13px, never a pill, a badge or a bare word. The dot carries the
   state: green good, MKS blue on trial, amber soon to need something, red a problem (its word red too), grey off.
   .status-dot (green; .trial .warn .danger .off), .status-warn (amber), .app-status-off (grey), .licence-state,
   .app-status-problem and .member-app-problem (red), and a <Tag> with its dot are all this. */
.status-dot, .status-warn, .app-status-off, .app-status-problem, .member-app-problem, .licence-state, .tag.has-dot {
    display: inline-flex; align-items: center; gap: 6px; padding: 0; border-radius: 0; background: none;
    font-size: 13px; font-weight: 500; line-height: 18px; letter-spacing: 0; color: var(--text-label); white-space: nowrap; vertical-align: baseline;
}
.status-dot::before, .status-warn::before, .app-status-off::before, .app-status-problem::before, .member-app-problem::before, .licence-state::before {
    content: ""; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--ok-dot);
}
.status-dot.trial::before { background: var(--mks-blue); }
.status-warn::before, .status-dot.warn::before { background: var(--warn-dot); }
.status-dot.off, .app-status-off, .licence-state.off, .member-app-problem:not(.danger) { color: var(--text-faint); }
.status-dot.off::before, .app-status-off::before, .licence-state.off::before, .member-app-problem:not(.danger)::before { background: var(--dot-off); }
.status-dot.danger, .app-status-problem, .member-app-problem.danger { color: var(--danger-fg); }
.status-dot.danger::before, .app-status-problem::before, .member-app-problem.danger::before { background: var(--danger-dot); }
/* The dot says it: no icon in front of a state */
.status-warn > .material-symbols-outlined, .app-status-problem > .material-symbols-outlined, .member-app-problem > .material-symbols-outlined { display: none; }
.plan-name.free { color: var(--text-dim); }

.plain-list { margin: 0; padding-left: 18px; color: var(--text-faint); font-size: 14px; display: grid; gap: 4px; }

/* ============================================================
   Sign-in pages: glass card on the grid backdrop
   ============================================================ */
/* The light page, the MKS wordmark above a white card, the apps' round icons under it; no bar at the top */
.app-shell.public:has(.auth-layout) .public-bar { display: none; }
.auth-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8vh 16px 48px;
}
.auth-wordmark { margin-bottom: 26px; font-family: "oswald-bold"; font-size: 34px; line-height: 42px; letter-spacing: .02em; text-decoration: none !important; }
.auth-wordmark .logo-mks { font-family: "oswald-bold"; color: #00AEF0; }
.auth-wordmark .logo-dtech { font-family: "oswald-medium"; color: var(--wordmark-ink); }
.auth-apps { display: flex; gap: 16px; margin-top: 30px; }
.auth-apps img { width: 30px; height: 30px; }
.auth-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -10px rgba(16, 24, 40, 0.12);
    padding: 30px 32px 26px;
    overflow: hidden;
}
.auth-eyebrow {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-faint);
    margin: 0 0 2px;
}
.auth-card h1 { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 0.35rem; color: var(--ink); }
.auth-sub { font-size: 14px; color: var(--text-label); margin: 0 0 1.3rem; }
.auth-card .mb-3 { margin-bottom: 0.9rem !important; }
.auth-card .btn { width: 100%; padding: 8px 16px; }
.auth-card .btn-sm { width: auto; }

.auth-error, .auth-success {
    margin-top: 14px;
    padding: 10px 13px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.45;
}
.auth-error { background: var(--danger-bg); color: var(--danger-fg2); text-align: left; }
.auth-success { background: var(--ok-bg); color: var(--ok-fg); text-align: left; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--divider); }

.provider-buttons { display: grid; gap: 8px; }
.provider-buttons .btn { font-weight: 500; }
.provider-button { display: inline-flex !important; align-items: center; justify-content: center; gap: 10px; }

.email-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 13px;
    margin-bottom: 1rem;
    border-radius: 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 14.5px;
}
.email-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-note { font-size: 14px; color: var(--text-dim); line-height: 1.55; margin: 0 0 1.1rem; }

.auth-links {
    margin-top: 1.2rem;
    padding-top: 0;
    border-top: 0;
    display: grid;
    gap: 6px;
    justify-items: center;
    font-size: 13px;
    color: var(--text-faint);
}
.auth-links .auth-link-row { display: flex; gap: 6px; padding: 0; }
.auth-links .auth-link-row span { color: var(--text-faint); }
.link-button { color: var(--accent); cursor: pointer; text-decoration: none; }
.link-button:hover { color: var(--accent-ink); text-decoration: underline; }
button.link-button { background: none; border: 0; padding: 0; font: inherit; }

.code-input {
    font-family: var(--mono);
    font-size: 22px !important;
    letter-spacing: 0.45em;
    text-align: center;
    padding: 12px 13px !important;
}
.code-input::placeholder { letter-spacing: 0.45em; color: var(--bg-2); }

/* ============================================================
   Organization member list
   ============================================================ */
.member-list { display: grid; border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.member-row:first-child { border-top: none; }
.member-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--cyan-tint); color: var(--nav-active-fg); font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.member-who { flex: 1; min-width: 0; }
.member-name { font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-email { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-role { width: auto; min-width: 110px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }

/* ============================================================
   Company domains and company accounts
   ============================================================ */
.domain-card { border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 14px 16px; display: grid; gap: 10px; }
.domain-card.verified { border-color: rgba(34, 197, 94, .25); }
.domain-head { display: flex; align-items: center; gap: 10px; }
.domain-name { font-weight: 600; font-size: 15px; }
.domain-help { margin: 0; font-size: 13.5px; color: var(--text-faint); }
.dns-record { display: grid; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--border-2); font-size: 13px; }
.dns-record > div { display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.dns-label { width: 46px; flex-shrink: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.dns-record code { color: var(--text); background: none; padding: 0; word-break: break-all; font-size: 12.5px; user-select: all; }
.company-chip { margin-left: 6px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0; background: var(--cyan-tint); color: var(--cyan-ink); vertical-align: 1px; }
.member-confirm { display: grid; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--danger-bg); color: var(--danger-fg2); font-size: 13.5px; }


/* ============================================================
   App pages (sidebar shell): header row with an action,
   settings with their own side menu, list toolbars, data tables
   ============================================================ */
.page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.page-head-row .btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
/* On pages made of settings cards, the header ends where the cards end, so its button lines up with them */
.page-head-row:has(~ .plan-card) { max-width: 760px; }
/* Under tabs, every tab is as wide as the tabs: cards, tables and the header alike */
.page-tabs ~ .page-head-row, .page-tabs ~ .plan-card { max-width: none; }
/* A team's page: its cards run full width, so Settings sits at their right edge */
.page-head-row.wide { max-width: none; }
.page-head-row .btn .material-symbols-outlined { font-size: 17px; }
.narrow-page { max-width: 640px; }
.text-faint { color: var(--text-faint); }

.settings-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; }
.section-nav { position: sticky; top: 0; display: grid; gap: 2px; }
.section-nav-label { font-size: 12.5px; font-weight: 600; color: var(--text-faint); padding: 0 10px 8px; }
.section-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-dim); font-size: 14px; font-weight: 500; text-decoration: none !important; }
.section-link .material-symbols-outlined { font-size: 18px; color: var(--text-faint); }
.section-link:hover { background: var(--hover-tint); color: var(--text); }
.section-link.active { background: var(--cyan-tint); color: var(--nav-active-fg); box-shadow: none; }
.section-link.active .material-symbols-outlined { color: var(--mks-blue); }
.section-link.danger, .section-link.danger .material-symbols-outlined { color: var(--danger-fg); }
.section-content { min-width: 0; }
.settings-section.stacked { grid-template-columns: 1fr; gap: 16px; }
@media (max-width: 900px) {
    .settings-shell { grid-template-columns: 1fr; gap: 16px; }
    .section-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
    .section-nav-label { display: none; }
}

.list-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.list-toolbar .form-select { padding: 7px 36px 7px 14px; font-size: 14px; min-width: 130px; border-radius: 999px; background-position: right 12px center; }
/* A choice of two or three (tabs over a list, Monthly/Yearly): white pill on a grey track */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-2); }
.list-toolbar .segmented { margin-right: auto; }
.segmented button { border: 0; background: transparent; border-radius: 999px; padding: 5px 14px; font-size: 13.5px; font-weight: 500; line-height: 20px; color: var(--text-label); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.segmented button:hover:not(:disabled):not(.active):not([aria-checked="true"]) { color: var(--ink); }
.segmented button.active, .segmented button[aria-checked="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.segmented button:focus-visible { outline: none; box-shadow: var(--ring); }
.segmented button:disabled { opacity: .5; }
.segmented .count { font-size: 12.5px; font-weight: 500; color: var(--text-faint); background: none; padding: 0; }
.search-box { position: relative; width: 280px; max-width: 100%; }
.search-box .material-symbols-outlined { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--text-ghost); pointer-events: none; }
.search-box .form-control { padding: 7px 14px 7px 36px; font-size: 14px; border-radius: 999px; }

.data-card { padding: 0 !important; overflow: visible; }
.data-table > thead th { padding: 10px 16px; border-bottom-color: var(--divider); }
.data-table > tbody td { padding: 12px 16px; vertical-align: middle; }
.data-table > tbody tr:last-child td { border-bottom: none; }
.data-table > tbody tr:hover > * { background: var(--bg-alt); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.you-chip, .guest-chip { padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0; background: var(--chip-bg); color: var(--text-label); vertical-align: 1px; }
.you-chip { margin-left: 6px; }
.role-label { font-size: 13.5px; color: var(--text-dim); }
.icon-button { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; color: var(--text-faint); font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.icon-button:hover:not(:disabled) { background: var(--chip-bg); color: var(--ink); }
.icon-button:disabled { opacity: .35; }
.dropdown-item .material-symbols-outlined { font-size: 18px; vertical-align: -4px; margin-right: 6px; color: inherit; opacity: .75; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 16px; border-top: 1px solid var(--divider); font-size: 13px; color: var(--text-faint); }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--text-faint); }
.empty-state .material-symbols-outlined { font-size: 34px; color: var(--text-ghost); }
.empty-state p { margin: 0; }
.inline-confirm { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--danger-bg); color: var(--danger-fg2); font-size: 13.5px; }

/* ---------- dialog ---------- */
/* White, 16px corners, the MKS wordmark on top, the title under it (with the app's icon or a red one), no lines
   inside: the buttons sit at the bottom right */
.mks-dialog-backdrop { position: fixed; inset: 0; z-index: 1050; background: rgba(16, 24, 40, .34); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.mks-dialog { width: 100%; max-width: 440px; background: var(--card); border-radius: 16px; box-shadow: 0 24px 60px rgba(16, 24, 40, .22), 0 0 0 1px rgba(16, 24, 40, .05); outline: none; font-size: 14px; }
.mks-dialog.wide { max-width: 560px; }
.mks-dialog-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 0 22px; }
.mks-wordmark { font-family: "oswald-bold"; font-size: 15px; line-height: 20px; letter-spacing: .02em; color: #00AEF0; white-space: nowrap; }
.mks-wordmark .logo-mks { font-family: "oswald-bold"; color: #00AEF0; }
.mks-wordmark .logo-dtech { font-family: "oswald-medium"; color: var(--wordmark-ink); }
.mks-dialog-head { display: flex; align-items: center; gap: 12px; padding: 10px 22px 4px; }
.mks-dialog-head .app-logo { width: 32px; height: 32px; font-size: 14px; }
.mks-dialog-title { flex: 1; min-width: 0; display: grid; }
.mks-dialog-head h2 { font-size: 16px; font-weight: 600; line-height: 22px; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
.mks-dialog-sub { font-size: 13px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mks-dialog-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--cyan-tint); color: var(--mks-blue); font-size: 18px !important; }
.mks-dialog-icon.danger { background: var(--danger-bg); color: var(--danger-dot); }
.mks-dialog-close { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: var(--text-faint); font-size: 18px !important; border-radius: 50%; }
.mks-dialog-close:hover { background: var(--chip-bg); color: var(--ink); }
.mks-dialog-close:focus-visible { outline: none; box-shadow: var(--ring); }
.mks-dialog-body { padding: 16px 22px 22px; display: grid; gap: 14px; }
.mks-dialog-body .form-label { margin-bottom: 6px; }
.mks-dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; border-top: 0; background: none; border-radius: 0 0 16px 16px; }
/* A question before something that can't be undone: the red icon by the title, one line, then the action and Cancel */
.mks-dialog.confirm { max-width: 400px; }
.mks-confirm { display: grid; gap: 12px; padding: 14px 22px 20px; }
.mks-confirm:empty { padding: 0 0 8px; }
.mks-confirm h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.mks-confirm p { margin: 0; color: var(--text-dim); line-height: 1.5; }
.dialog-note { margin: 0; font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .form-row-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- overview tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-tile { display: grid; gap: 8px; padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-card); color: var(--text); text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.stat-tile:hover { border-color: var(--accent-line); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); color: var(--text); }
.stat-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-label); font-weight: 500; }
.stat-label .material-symbols-outlined { font-size: 18px; color: var(--mks-blue); }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.stat-foot { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-card { padding: 18px 20px; display: grid; gap: 4px; }
.setup-card .card-eyebrow { margin-bottom: 6px; }
.setup-step { display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.setup-step:hover { background: var(--bg); color: var(--text); }
.setup-step > .material-symbols-outlined:first-child { color: var(--text-ghost); font-size: 22px; }
.setup-step.done > .material-symbols-outlined:first-child { color: var(--ok-text); }
.setup-step.done strong { text-decoration: line-through; color: var(--text-faint); }
.setup-text { flex: 1; display: grid; font-size: 14px; }
.setup-text span { font-size: 13px; color: var(--text-faint); }
.setup-step .chevron { color: var(--text-ghost); }

/* ---------- apps ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.app-card { display: grid; gap: 16px; padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.app-card.inactive { opacity: .7; }
.app-head { display: flex; align-items: center; gap: 12px; }
.app-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 600; color: #fff; background: var(--mks-blue); flex-shrink: 0; }
.app-card.inactive .app-icon { background: var(--bg-2); color: var(--text-faint); }
.app-title { display: grid; gap: 2px; min-width: 0; }
.app-name { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.app-status-off { font-size: 13px; color: var(--text-faint); }
.app-seats { display: grid; gap: 6px; }
.app-seats-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-faint); }
.seat-meter { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.seat-meter span { display: block; height: 100%; border-radius: 999px; background: var(--mks-blue); }
.app-facts { display: grid; gap: 6px; font-size: 13px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 12px; }
.app-facts .material-symbols-outlined { font-size: 16px; vertical-align: -3px; margin-right: 4px; }
.app-facts .app-fact-scheduled { color: var(--warn-fg); } /* a change set in Stripe for the next renewal */
/* A card's footer action that runs something (opens Stripe): drawn as the footer's links, with a spinner while it works */
.card-action { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; }
.card-action:hover:not(:disabled) { text-decoration: underline; }
.card-action:disabled { cursor: default; opacity: .55; }
.card-action:has(.spinner-border) { opacity: 1; color: var(--text-dim); }
.card-action .material-symbols-outlined { font-size: 17px; }
.card-action .spinner-border { width: 14px; height: 14px; border-width: 2px; }
.card-action.is-quiet { color: var(--text-dim); }
.card-action.is-quiet:hover:not(:disabled) { color: var(--danger-text); }
/* The Apps page's cards, drawn as Home's tiles (whose title styles are Home's own) */
.app-card-tile .home-app-title { display: grid; min-width: 0; }
.app-card-tile .home-app-source { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-card-tile .home-app-state { margin-left: auto; flex-shrink: 0; align-self: flex-start; font-size: 13px; white-space: nowrap; }
.app-card-tile .home-app-state .status-dot, .app-card-tile .home-app-state .status-warn { font-size: inherit; }
.app-card-tile .app-facts { margin-top: auto; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head-actions .spinner-border { width: 15px; height: 15px; border-width: 2px; }

/* Columns a table drops on a phone, so the rest fits */
@media (max-width: 640px) {
    .data-table .col-wide { display: none; }
    /* Members: the name takes what the role and menu leave, its email cut short */
    .members-table td:first-child { width: 100%; max-width: 0; }
    .members-table .member-role { width: auto; min-width: 108px; }
    .members-table .member-avatar { display: none; }
    /* Tables kept to a few columns: their cells wrap rather than push the table wider */
    .phone-wrap td, .phone-wrap .app-name-cell, .phone-wrap .member-email { white-space: normal !important; overflow-wrap: anywhere; }
}

@media (max-width: 700px) {
    .col-account { display: none; }
    .data-table > thead th, .data-table > tbody td { padding-left: 12px; padding-right: 8px; }
    .data-table .member-role { min-width: 0; padding-right: 30px; background-position: right 8px center; }
    .page-head-row { flex-direction: column; gap: 0; }
    .page-head-row .btn { margin-top: 0; margin-bottom: 20px; }
    .search-box { width: 100%; }
}

/* ---------- personal overview: organizations and hints ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 16px; }
.section-head.first { margin-top: 0; }
/* An app card's actions along its foot (Home), as the legacy portal's: Download, Manage, Team */
/* An app you don't have: faded, the whole card a link to it on the website */
/* An app you don't have: a white card with a dashed border, its icon in colour, Get as a small white button */
.home-app.home-app-missing { color: var(--text) !important; text-decoration: none !important; background: var(--card); border-style: dashed; border-color: var(--border-hover); box-shadow: none; transition: border-color .15s, background .15s; }
.home-app-missing .home-app-name { color: var(--text-strong); }
.home-app.home-app-missing:hover { border-color: var(--accent-line, rgba(29, 183, 241, .4)); }
.home-app-get { margin-left: auto; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--card); font-size: 13.5px; font-weight: 600; color: var(--text-strong); transition: background .15s, border-color .15s; }
.home-app.home-app-missing:hover .home-app-get { background: var(--hover-bg); border-color: var(--border-hover); }
.home-app-get .material-symbols-outlined { font-size: 16px; }
/* Pinned to the card's foot, so the feet of a row of cards line up: small white pills, the app's own site (Open) last
   on the right in MKS blue */
.home-app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; border-top: 0; }
.home-app-actions a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--card); font-size: 13.5px; font-weight: 600; color: var(--text-strong); white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s; }
.home-app-actions a:hover { background: var(--hover-bg); border-color: var(--border-hover); color: var(--ink); }
.home-app-actions .material-symbols-outlined { font-size: 16px; }
.home-app-ended { margin-top: -6px; font-size: 13px; color: var(--text-dim); }
.home-app-actions a.home-app-site { margin-left: auto; gap: 4px; background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }
.home-app-actions a.home-app-site:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.home-app-actions a.home-app-site .material-symbols-outlined { font-size: 15px; }
/* An app you don't have stays compact beside full cards instead of stretching to the row's height */
.home-app.home-app-missing { align-self: start; }
.section-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.section-head a { font-size: 13.5px; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.org-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0, 0, 0, .04); color: var(--text); text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.org-card:hover { border-color: var(--accent-line); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); color: var(--text); }
.org-card.new { border-style: dashed; box-shadow: none; background: transparent; }
.org-avatar { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #fff; background: var(--mks-blue); }
.org-avatar.new { background: var(--bg-2); color: var(--text-faint); font-size: 20px; font-weight: 400; }
.org-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.org-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-sub { font-size: 12.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-card .chevron { color: var(--text-ghost); }
/* ---------- home: app widgets ---------- */
/* Wide enough for a card's three buttons on one line */
.home-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.home-app { display: flex; flex-direction: column; gap: 16px; padding: 18px 18px 16px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.home-app .app-logo { width: 44px; height: 44px; }
.home-app.inactive { opacity: .6; }
.home-app-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-app-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-logo { width: 40px; height: 40px; flex-shrink: 0; object-fit: cover; border-radius: 50%; }
.app-logo-initial { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--mks-blue); color: #fff; font-weight: 600; }
.home-app-teams { display: flex; flex-wrap: wrap; gap: 6px; }
.home-team { display: grid; gap: 18px; margin-top: 28px; padding: 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.home-team-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.home-team-name { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.home-team-meta { font-size: 13px; color: var(--text-faint); }
.home-team-empty { display: grid; justify-items: center; gap: 8px; padding: 28px 16px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--border-2); font-size: 14px; color: var(--text-faint); }
.home-team-empty .material-symbols-outlined { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); font-size: 24px; color: var(--text-ghost, var(--text-faint)); }
.home-team .home-app { box-shadow: none; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 14px; }
.activity-list li:last-child { border-bottom: 0; }
.activity-time { flex-shrink: 0; font-size: 12.5px; color: var(--text-faint); }
.apps-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); font-size: 14px; color: var(--text-faint); }
.apps-empty a { font-size: 13.5px; font-weight: 600; }
.hint-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--radius); background: var(--info-bg); border: 1px solid rgba(3, 105, 161, .15); margin-bottom: 8px; }
.hint-icon { font-size: 26px; color: var(--info-fg); }
.hint-text { flex: 1; min-width: 220px; display: grid; gap: 2px; font-size: 14px; color: var(--text-dim); }
.hint-text strong { color: var(--text); font-weight: 600; }
.hint-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- reconnecting box (replaces Blazor's default) ---------- */
.mks-reconnect { display: none; position: fixed; inset: 0; z-index: 2000; align-items: center; justify-content: center; background: var(--reconnect-veil); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.mks-reconnect.components-reconnect-show, .mks-reconnect.components-reconnect-retrying, .mks-reconnect.components-reconnect-failed, .mks-reconnect.components-reconnect-rejected { display: flex; }
.mks-reconnect-card { width: 260px; padding: 26px 24px 22px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 24px 64px rgba(0, 0, 0, .12); text-align: center; }
.mks-reconnect-logo { font-family: var(--font-logo); font-size: 22px; letter-spacing: .02em; margin-bottom: 18px; }
.mks-reconnect-logo .logo-mks { font-family: "oswald-bold"; color: #00AEF0; }
.mks-reconnect-logo .logo-dtech { color: var(--text); }
.mks-reconnect-bar { height: 3px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-bottom: 14px; }
.mks-reconnect-bar span { display: block; width: 40%; height: 100%; border-radius: 999px; background: var(--mks-blue); animation: mks-reconnect-slide 1.1s ease-in-out infinite; }
@keyframes mks-reconnect-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
.mks-reconnect p { margin: 0; font-size: 13.5px; color: var(--text-faint); }
.mks-reconnect-lost { display: none; }
.mks-reconnect.components-reconnect-failed .mks-reconnect-busy, .mks-reconnect.components-reconnect-rejected .mks-reconnect-busy { display: none; }
.mks-reconnect.components-reconnect-failed .mks-reconnect-lost { display: block; }
.mks-reconnect.components-reconnect-failed .mks-reconnect-bar span { animation: none; width: 100%; background: var(--danger-fg); opacity: .5; }
.mks-reconnect-lost button { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.mks-reconnect-lost button:hover { text-decoration: underline; }

/* ---------- pages don't scroll, their lists do ---------- */
.app-main > .content-container > * { flex-shrink: 0; }
.data-card { flex: 1 1 0; min-height: 220px; display: flex; flex-direction: column; overflow: hidden; }
.data-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* A card that is its own scroller (class="card data-card data-scroll"): it fills the rest too, never its rows' height */
.data-card.data-scroll { flex: 1 1 0; }
/* A short list (a product's plans, its settings): the card is as tall as its rows, and scrolls them once they would
   pass the window */
.data-card.fit { flex: 0 1 auto; min-height: 0; }
.plan-card > .data-scroll > .setting-row-button:first-child, .plan-card > .data-scroll > .setting-row:first-child { border-top: 0; }
.data-scroll .settings-matrix > thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: inset 0 -1px 0 var(--border); }
.data-scroll .data-table > thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); box-shadow: inset 0 -1px 0 var(--border); }
.data-card .pager { flex-shrink: 0; }
.data-card.empty-state, .data-card > .empty-state { flex: 0 0 auto; }
@media (max-width: 900px) {
    .data-card, .data-card.data-scroll, .data-card.fit { flex: 0 0 auto; min-height: 0; overflow: visible; }
    .data-scroll { overflow: visible; }
    .data-scroll .data-table > thead th { position: static; }
}

/* ---------- verified teams ---------- */
.verified-badge { display: inline-flex; align-items: center; color: var(--mks-blue); flex-shrink: 0; }
.verified-badge .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 1; }
.verified-pill { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; padding: 3px 10px 3px 7px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; letter-spacing: 0; vertical-align: middle; }
.verified-pill .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 1; }

/* Cancel: a quiet white button with red text, next to the main action. */
/* Cancel: quiet grey, and always to the right of the action it cancels (a Delete stays at the far left) */
.btn.btn-cancel { background: var(--card); border: 1px solid var(--border-2); color: var(--text-dim); order: 10; }
.btn.btn-cancel:hover, .btn.btn-cancel:focus-visible { background: var(--bg); border-color: var(--border-2); color: var(--text); }
.mks-dialog-foot .me-auto, .modal-footer .me-auto { order: -1; }

/* The generic form dialog (Add/Edit product, plan, client) in the same look as the other dialogs */
.modal-content { border-radius: 16px; border: 0; box-shadow: 0 24px 60px rgba(16, 24, 40, .22), 0 0 0 1px rgba(16, 24, 40, .05); overflow: hidden; font-size: 14px; }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 10px 22px 4px !important; border-bottom: 0 !important; }
.modal-header .modal-title { flex: 1; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.modal-header .btn-close { width: 28px; height: 28px; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: none; opacity: 1; color: var(--text-faint); box-shadow: none; }
.modal-header .btn-close:hover { background: var(--bg); color: var(--text); }
.modal-header .btn-close .material-symbols-outlined { font-size: 18px; }
.modal-body { padding: 16px 22px 22px; }
.modal-body .form-group { margin-bottom: 14px; }
.modal-body .form-group:last-child { margin-bottom: 0; }
.modal-body .form-group > label { color: var(--text-dim); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.modal-body .form-group .field-error { min-height: 0; margin-top: 4px; }
.modal-body .form-group .field-error:empty { display: none; }
.modal-body .form-control { box-shadow: none; }
.modal-footer { display: flex; justify-content: flex-end !important; gap: 8px; padding: 0 22px 20px; border-top: 0; background: none; }
.modal-footer .right-actions { display: flex; gap: 8px; }
.modal-footer > * { margin: 0; }


/* ============================================================
   Settings cards (admin plan and product pages): one setting per row
   ============================================================ */
.plan-card { min-height: 0 !important; padding: 0; margin-bottom: 18px; max-width: 760px; }

/* A card's header is a tinted band in the table headers' small capitals, so it never reads as one of its rows */
.plan-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 22px; background: var(--bg-sunken); border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.plan-card-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-faint); }
.plan-card-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-faint); }
.card-head-meta { font-size: 13px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 8px; }
.card-head-meta .btn-reset { color: var(--mks-blue); font-size: 13px; }

/* One setting per row: what it is on the left, the control on the right. */
.setting-row { display: flex; align-items: center; gap: 24px; padding: 14px 22px; border-top: 1px solid var(--border); }
.setting-text { flex: 1; min-width: 0; }
.setting-name { display: block; margin: 0; font-size: 14.5px; font-weight: 500; color: var(--text); }
.setting-help { font-size: 12.5px; color: var(--text-faint); line-height: 1.45; }
.setting-control { flex: 0 0 200px; display: flex; justify-content: flex-end; }
.setting-control .form-select, .setting-control > .form-control { width: 100%; }
.setting-control .form-switch .form-check-input { width: 2.4em; height: 1.3em; cursor: pointer; }

/* A number with its unit inside the field. */
.input-unit { position: relative; width: 100%; }
.input-unit .form-control { padding-right: 48px; }
.input-unit span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-faint); pointer-events: none; }

.plan-card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 14px 14px; }
.plan-message { font-size: 13px; }
.plan-message.ok { color: var(--ok-text); }
.plan-message.error { color: var(--danger-fg, #b42318); }

@media (max-width: 640px) {
    .setting-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .setting-control { flex-basis: auto; justify-content: flex-start; }
}

.plan-intro { margin: 2px 0 0; max-width: 620px; font-size: 13.5px; color: var(--text-faint); }
.setting-key { margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: var(--bg-2); color: var(--text-dim); font-size: 11.5px; font-weight: 400; }
.setting-row-button { width: 100%; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); cursor: pointer; }
.plan-card > .setting-row-button:first-child, .plan-card > .setting-row:first-child { border-top: 0; }
.setting-row-button:hover { background: var(--bg); }
.setting-default { flex-shrink: 0; display: grid; justify-items: end; font-size: 12.5px; color: var(--text-faint); }
.setting-default strong { color: var(--text); font-weight: 500; }
.setting-type { font-size: 11.5px; }
.setting-go { color: var(--text-faint); }
.setting-control-wide { flex-basis: 280px; }
/* Phone: a row stacks its control under its name, so no basis (it would become a height); a clickable row (a plan)
   stays one line with its chevron; a read-only value starts at the left like the controls */
@media (max-width: 640px) {
    .setting-control, .setting-control-wide { flex: 0 0 auto; }
    .setting-row-button { flex-direction: row; align-items: center; gap: 12px; }
    .setting-row .setting-value { max-width: none; text-align: left; }
    .setting-row .segmented { display: flex; width: 100%; border-radius: 12px; }
    .setting-row .segmented button { flex: 1 1 0; justify-content: center; white-space: normal; text-align: center; line-height: 1.25; border-radius: 9px; }
}
.btn-reset { margin-left: 6px; padding: 0; border: 0; background: none; font-size: 12.5px; color: var(--accent); cursor: pointer; }
.btn-reset:hover { text-decoration: underline; }
.plan-card-foot-start { justify-content: flex-start; }
.price-input { flex: 1; max-width: 420px; }

/* A value shown on the right of a settings row (read-only). */
.setting-value { flex-shrink: 0; max-width: 60%; font-size: 13.5px; color: var(--text); text-align: right; overflow-wrap: anywhere; }
.setting-value-text { color: var(--text-dim); }

/* Small labels on a plan or licence: what kind it is. */
.plan-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.plan-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--bg-2); color: var(--text-dim); font-size: 11.5px; font-weight: 500; line-height: 1.6; vertical-align: 1px; }
.plan-chip.free { background: var(--accent-soft); color: var(--accent); }
.plan-chip.warn { background: var(--b-amber-bg); color: var(--b-amber-fg); }
.plan-chip.auto { background: var(--ok-bg); color: var(--ok-fg); }
.plan-chip.unlimited { background: var(--b-purple-bg); color: var(--b-purple-fg); }
.status-chip { display: inline-flex; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.status-chip.ok { background: rgba(34, 197, 94, .1); color: var(--ok-text); }
.status-chip.off { background: var(--bg-2); color: var(--text-faint); }
.holder-icon { font-size: 17px !important; margin-right: 5px; vertical-align: -3px; color: var(--text-faint); }
.setting-value code, .setting-help code { padding: 1px 6px; border-radius: 5px; background: var(--bg-2); color: var(--text-dim); font-size: 12px; }

/* Where a page sits, above its title (Components/Controls/Crumbs.razor). */
/* Where you are: the parents small and muted, a light chevron between, the page itself in ink */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13.5px; line-height: 20px; color: var(--text-faint); }
.crumbs a { color: var(--text-faint); font-weight: 500; text-decoration: none; border-radius: 4px; transition: color .12s; }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs > span:last-child { color: var(--text); font-weight: 600; }
.crumbs-sep { font-size: 16px !important; color: var(--text-ghost, var(--text-faint)); opacity: .7; }

/* An API call shown to admins: method, path, request and response. */
.api-example { display: grid; gap: 10px; padding: 4px 22px 18px; }
/* Folded: its header alone, a click opens it */
.api-fold > summary { list-style: none; cursor: pointer; border-radius: inherit; }
.api-fold > summary::-webkit-details-marker { display: none; }
.api-fold > summary .material-symbols-outlined { font-size: 18px; color: var(--text-faint); transition: transform .15s; }
.api-fold[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 14px; }
.api-fold[open] > summary .material-symbols-outlined { transform: rotate(180deg); }
/* A licence's own rules: its rows straight under the header */
.rules-fold[open] > summary { margin-bottom: 0; }
.api-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.api-line code { color: var(--text); background: none; padding: 0; }
.api-method { padding: 1px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.api-example pre { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); white-space: pre-wrap; }

/* Product app settings: a row per setting, a column per plan. */
.settings-matrix-card { max-width: none; }
.settings-matrix-scroll { overflow-x: auto; }
.settings-matrix { width: 100%; border-collapse: collapse; font-size: 14px; }
.settings-matrix th { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-faint); text-align: left; white-space: nowrap; }
.settings-matrix th a { color: var(--text); text-decoration: none; }
.settings-matrix th a:hover { color: var(--accent-ink); }
.settings-matrix td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.settings-matrix tbody tr:last-child td { border-bottom: 0; }
.matrix-setting { min-width: 220px; }
.matrix-setting-row { display: flex; align-items: flex-start; gap: 10px; }
.matrix-gear { flex-shrink: 0; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--card); font-size: 18px !important; color: var(--text-faint); cursor: pointer; transition: color .12s, border-color .12s; }
.matrix-gear:hover, .matrix-gear:focus-visible { color: var(--mks-blue); border-color: var(--accent-line, rgba(29, 183, 241, .4)); outline: none; }
.plan-card-foot .btn .material-symbols-outlined { font-size: 16px; vertical-align: -3px; margin-right: 4px; }
.matrix-setting .setting-key { margin-left: 0; display: inline-block; margin-top: 2px; }
.matrix-default { color: var(--text-dim); white-space: nowrap; }
.matrix-input, .settings-matrix .mks-select { min-width: 120px; }
.settings-matrix th .plan-chip, .setting-name + .plan-chip, td > .plan-chip { margin-left: 6px; }

/* Values typed as badges (Components/Controls/TagInput.razor). */
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 6px 8px; border: 1px solid var(--border-2); border-radius: 9px; background: var(--card); cursor: text; transition: border-color .15s, box-shadow .15s; }
.tag-input:focus-within { border-color: var(--mks-blue-dim); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; }
.tag-remove { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 15px !important; cursor: pointer; }
.tag-remove:hover { background: rgba(29, 183, 241, .18); }
.tag-field { flex: 1; min-width: 120px; padding: 4px 4px; border: 0; outline: none; font-family: var(--sans); font-size: 14.5px; color: var(--text); background: transparent; }

/* Clickable rows: no link underline, the arrow close to its text. */
a.setting-row-button, a.setting-row-button:hover, a.setting-row-button * { text-decoration: none !important; }
.setting-row-button { gap: 16px; }
.setting-row-button .setting-go { margin-left: -10px; font-size: 20px !important; }

/* ============================================================
   Staff pages over the product servers (Admin/Beam, Admin/RhinoSync)
   ============================================================ */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
/* A team's BEAM health: the seven figures on one row when the page is wide enough */
@media (min-width: 1200px) { .admin-grid.health-kpis { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.admin-band { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.admin-band .material-symbols-outlined { font-size: 15px; }
.admin-band.thriving { background: var(--ok-bg); color: var(--ok-fg); }
.admin-band.steady { background: var(--info-bg); color: var(--info-fg); }
.admin-band.cooling { background: var(--warn-bg); color: var(--warn-fg); }
.admin-band.slipping { background: var(--b-orange-bg); color: var(--b-orange-fg); }
.admin-band.quiet { background: var(--danger-bg); color: var(--danger-fg2); }
.admin-mono { font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; word-break: break-all; }
.admin-table-wrap { overflow-x: auto; }
.admin-table-wrap table { font-size: 13.5px; }
.admin-share { display: inline-block; height: 6px; border-radius: 3px; background: var(--font-color-blue); vertical-align: middle; margin-right: 6px; }
.admin-danger-zone { border-color: rgba(220, 38, 38, .35) !important; }
.main-view .btn-sm > .material-symbols-outlined { font-size: 17px; vertical-align: -4px; }
.main-view .btn-sm { white-space: nowrap; }

/* Icons inside buttons follow the smaller text */
.btn .material-symbols-outlined { font-size: 17px; line-height: 1; }
.btn-sm .material-symbols-outlined { font-size: 15px; }

/* Pages with their own side menu (Inventory, Clients, a product, a plan): the side menu sits at the left of the
   content area and the page itself is centred in the space that is left */
/* A page with its own side menu takes the whole width: the page is centred in it, the menu just to its left
   (LeftNavigationLayout.razor.css) */
/* Staff pages are wider than the customer's (their tables have more columns): one width for all of them, the
   Overview included; a page with a side menu takes it as its column (LeftNavigationLayout.razor.css) */
.app-shell.admin { --page-max: 1400px; --nav-right-min: 0px; }
.app-shell.admin .content-container { max-width: calc(var(--page-max) + 80px); }
/* A scrollbar showing up on one page and not the next doesn't shift it (no mirrored sidebar: MainLayout.razor.css) */
.app-shell.admin .app-main, .app-shell.admin .main-view { scrollbar-gutter: stable; }
.app-main .content-container:has(.main-container) { max-width: none; }
/* The staff Overview has six figures and three panels: it takes more of a wide window */
.app-main .content-container:has(.ov-kpis) { max-width: calc(var(--page-max, 1360px) + 80px); }

/* The staff Controls page (Components/Pages/Admin/Controls.razor): every control on one sheet */
.controls-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.controls-grid > .plan-card { max-width: none; margin: 0; }
.controls-grid > .controls-wide { grid-column: 1 / -1; }
.controls-body { display: grid; gap: 16px; padding: 20px 22px; }
.controls-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.controls-footer { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; background: var(--bg-alt); box-shadow: inset 0 0 0 1px var(--border); }
.controls-nav { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.controls-nav .segmented { justify-self: start; }
.controls-cards { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; background: var(--bg); border-radius: 0 0 14px 14px; }
.controls-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.controls-stats .stat-tile { padding: 14px 16px; }
.controls-stats .stat-value { font-size: 24px; }
@media (max-width: 1100px) { .controls-grid, .controls-cards, .controls-nav { grid-template-columns: 1fr; } }

/* The form dialog (IModalService) sits and dims like Dialog.razor */
.modal-backdrop.show { background-color: #101828; opacity: .34; }
.modal .modal-dialog { margin-top: 12vh; }
.modal .modal-dialog:not(.modal-lg):not(.modal-xl) { max-width: 440px; }
a.card-head-meta { color: var(--accent); text-decoration: none; }
a.card-head-meta:hover { color: var(--accent-ink); text-decoration: underline; }

/* Settings rows: a segmented choice takes its own width; a row that depends on the one above is indented on a tint */
.setting-control-auto { flex: 0 0 auto; }
.setting-row.sub { background: var(--bg-alt); }
.setting-row.sub .setting-name { padding-left: 16px; font-weight: 400; color: var(--text-dim); }

/* A product's colours (Product page): a picker next to its hex value, and a preview of the name on its background */
.colour-control { flex: 0 0 200px; display: flex; gap: 8px; align-items: center; }
.colour-swatch { flex-shrink: 0; width: 38px; height: 36px; padding: 2px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--card); cursor: pointer; }
.colour-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.colour-swatch::-webkit-color-swatch { border: 0; border-radius: 5px; }
.colour-preview { display: inline-flex; align-items: baseline; gap: 8px; padding: 10px 16px; border-radius: 10px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.colour-preview-plan { color: #fff; }
@media (max-width: 640px) { .colour-control { flex: 0 0 auto; } }

/* The products list: each product's logo and its name in its accent */
.product-cell { display: inline-flex; align-items: center; gap: 10px; }
.product-cell .app-logo { width: 28px; height: 28px; font-size: 13px; }

/* Products as tiles: logo on the product's background, name in its accent, a row of counts */
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .product-grid { grid-template-columns: minmax(0, 1fr); } }
.product-tile { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 14px; border-radius: var(--radius); background: var(--card); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px -10px rgba(16, 24, 40, .12) !important; color: var(--text); text-decoration: none !important; transition: box-shadow .15s; }
.product-tile:hover { color: var(--text); box-shadow: 0 0 0 1px var(--accent-line), 0 10px 24px -12px rgba(16, 24, 40, .18) !important; }
.product-tile-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.product-tile-logo { flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.product-tile-logo .app-logo { width: 34px; height: 34px; }
.product-tile-name { display: grid; gap: 2px; min-width: 0; }
.product-tile-title { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-tile-name code { font-size: 12px; color: var(--text-faint); background: none; padding: 0; }
.product-tile-desc { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.45; }
.product-tile-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: auto -20px -14px; border-top: 1px solid var(--border); background: var(--bg-sunken); border-radius: 0 0 var(--radius) var(--radius); }
.product-tile-stats > span { display: grid; gap: 2px; padding: 10px 20px; }
.product-tile-stats > span + span { border-left: 0; }
/* The list's names in ink: only the logo carries the product's colour (the product page keeps its accent as a preview) */
.product-tile-title { color: var(--ink) !important; }
.product-tile-label { font-size: 12px; color: var(--text-faint); }
.product-tile-stats strong { font-size: 17px; font-weight: 600; }
.product-tile-stats > span { padding: 10px 14px; }
.product-tile-label { white-space: nowrap; }

/* Product page header: logo tile, name in the product's accent, slug */
.product-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.product-head-logo { width: 56px; height: 56px; border-radius: 14px; }
.product-head-logo .app-logo { width: 40px; height: 40px; }
.product-head-text { display: grid; gap: 4px; min-width: 0; }
.product-head-text code { font-size: 12.5px; color: var(--text-faint); background: none; padding: 0; }
.page-head-row:has(.product-head) { margin-bottom: 20px; }
@media (max-width: 700px) { .page-head-row:has(.product-head) { align-items: flex-start; } }

/* Round app icons: the disc is the logo, no tile behind it */
.product-tile-logo, .product-head-logo { background: none; width: auto; height: auto; border-radius: 50%; }
.product-tile-logo .app-logo { width: 44px; height: 44px; font-size: 18px; }
.product-head-logo .app-logo { width: 56px; height: 56px; font-size: 22px; }
img.app-logo { object-fit: contain; }

/* Reports (admin): the download card and the latest events */
.reports-card { max-width: 1080px; }
.reports-period { display: flex; align-items: center; gap: 8px; }
.reports-period .form-control { min-width: 0; }
.reports-dash { color: var(--text-faint); font-size: 13px; }
.badge-team { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--bg-alt, var(--bg-sunken)); color: var(--text-dim); font-size: 11px; font-weight: 500; vertical-align: 1px; }

/* Licences overview (admin): charts and the customers table */
.licences-filters { align-items: center; flex-wrap: nowrap; }
.licences-filters > * { width: 170px; flex: 0 0 auto; }
.licences-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .licences-stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
@media (max-width: 700px) {
    .licences-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .licences-filters { align-self: stretch; margin-bottom: 16px; }
    .licences-filters > * { flex: 1 1 0; width: auto; min-width: 0; }
}
.licences-card { max-width: none; }
.licences-chart { padding: 16px 22px 14px; }
.licences-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
@media (max-width: 900px) { .licences-grid { grid-template-columns: 1fr; } }
.licences-tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bg-2); margin-right: 10px; }
.licences-tabs button { border: 0; background: transparent; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; color: var(--text-label); }
.licences-tabs button.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.licences-card .card-head-meta { display: inline-flex; align-items: center; }
/* .licence-state: a state, as .status-dot (see "states" above); .on green, .off grey */
/* The charts (AdminLineChart, AdminNetChart, AdminShareBar): bars and lines stretch to the card, text stays its size */
.admin-chart-html { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: 240px 22px; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.admin-chart-axis-y { position: relative; }
.admin-chart-axis-y span { position: absolute; right: 8px; transform: translateY(-50%); white-space: nowrap; }
.admin-chart-plot { position: relative; }
.admin-chart-plot > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.admin-chart-gridline, .admin-chart-zero { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--chart-grid); }
.admin-chart-zero { border-top-color: var(--chart-zero); }
.admin-chart-axis-x { grid-column: 2; position: relative; container-type: inline-size; }
@container (max-width: 440px) { .admin-chart-axis-x span:nth-child(even) { display: none; } }
.admin-chart-axis-x span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; }
.admin-chart-axis-x span.admin-chart-x-first { transform: none; }
.admin-chart-axis-x span.admin-chart-x-last { transform: translateX(-100%); }
@media (max-width: 640px) { .admin-chart-axis-x span:nth-child(even) { display: none; } }
.admin-chart-slot { position: absolute; top: 0; bottom: 0; }
.admin-chart-slot:hover { background: rgba(29, 183, 241, .06); }
.admin-chart-slot > b { position: absolute; left: 15%; right: 15%; border-radius: 2px; }
.admin-net-up { background: var(--mks-blue); }
.admin-net-down { background: #f08a4b; }
.admin-line { fill: none; stroke: var(--mks-blue); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.admin-line-area { fill: rgba(29, 183, 241, .10); }
.admin-chart-slot > b.admin-line-dot { left: 50%; right: auto; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--mks-blue); opacity: 0; }
.admin-chart-slot:hover > b.admin-line-dot { opacity: 1; }
.admin-line-last { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--card); border: 2px solid var(--mks-blue); }
.admin-chart-tip { display: none; position: absolute; top: 8px; left: 100%; margin-left: 6px; z-index: 5; min-width: 150px; padding: 8px 10px; border-radius: 6px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 4px 14px rgba(15, 23, 42, .12); color: var(--text-dim); font-size: 12.5px; white-space: nowrap; pointer-events: none; }
.admin-chart-tip-left { left: auto; right: 100%; margin: 0 6px 0 0; }
.admin-chart-slot:hover .admin-chart-tip { display: flex; flex-direction: column; gap: 3px; }
.admin-chart-tip strong { color: var(--text); font-weight: 600; }
.admin-chart-tip b { color: var(--text); font-weight: 600; margin-left: 4px; }
.admin-chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.admin-chart-tip em { font-style: normal; }
.admin-chart-legend { display: flex; gap: 14px; margin-bottom: 8px; font-size: 12.5px; color: var(--text-dim); }
.admin-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.admin-net-up-key { background: var(--mks-blue); }
.admin-net-down-key { background: #f08a4b; }
.admin-share-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--bg); }
.admin-share-bar span { min-width: 3px; }
.admin-share-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 13px; color: var(--text-dim); }
.admin-share-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.admin-share-legend b { color: var(--text); font-weight: 600; margin-left: 4px; }
.admin-share-legend em { font-style: normal; color: var(--text-faint); margin-left: 4px; }

/* Licences: Revenue, Retention, Follow-up and a customer's panel */
.licences-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.licences-subhead { border-top: 1px solid var(--border); border-radius: 0; }
.licences-up { color: var(--ok-text); }
.licences-down { color: var(--warn-text); }
.licences-section { margin: 26px 0 12px; font-size: 15px; font-weight: 600; color: var(--text-dim); }
.licences-since { font-size: 24px; }
.stat-tile.warn .stat-value { color: var(--warn-text); }
.stat-tile.up .stat-value { color: var(--ok-text); }
.cohort-table td.cohort-cell { font-variant-numeric: tabular-nums; }
/* A label that does not fit its tile wraps under its icon; the values stay on one line at the bottom */
.licences-stats .stat-tile { grid-template-rows: 1fr auto; }
.licences-stats .stat-label { align-items: flex-start; line-height: 1.35; }

/* An app's logo before its name in the Licences tables */
.app-name-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.app-name-cell .app-logo { width: 20px; height: 20px; flex: 0 0 20px; font-size: 11px; }

/* ---------- view tabs: a page split into tabs so it fits the window (Controls/ViewTabs.razor) ---------- */
/* The page area beside a side menu fills the window: a list or a tab below fills the rest (LeftNavigationLayout) */
.main-view { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.main-view > * { flex-shrink: 0; }
.view-tabs { display: flex; align-items: flex-end; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0; }
.view-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px 11px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-faint); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color .12s, border-color .12s; }
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--mks-blue); }
.view-tab:focus-visible { outline: 2px solid var(--mks-blue); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.view-tabs-actions { margin-left: auto; align-self: center; display: flex; align-items: center; gap: 8px; padding-bottom: 6px; }
/* One tab's content: fills what is left of the window; a .data-card in it fills it and scrolls its list */
.view-panel { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.view-panel > * { flex-shrink: 0; }
.view-panel > .data-card { flex: 1 1 0; margin: 0; }
.view-panel .licences-grid { margin: 0; }
/* A tab whose content is several cards or a long form: it scrolls inside, the page stays */
.view-scroll { flex: 1 1 0; min-height: 0; overflow: auto; }
/* Table headers stay put wherever the table scrolls: in its list box, in a tab, or in the page area. A wrapper that
   scrolls sideways (.admin-table-wrap, .table-responsive) would hold the header instead, so there it does not clip. */
.main-view .admin-table-wrap, .main-view .table-responsive { overflow: visible; }
.main-view .data-table > thead th, .data-scroll .data-table > thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: inset 0 -1px 0 var(--divider); }
/* Slim scrollbars without arrow buttons; in a list box the bar starts below the header row */
.data-scroll, .view-scroll, .main-view { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.data-scroll::-webkit-scrollbar, .view-scroll::-webkit-scrollbar, .main-view::-webkit-scrollbar { width: 8px; height: 8px; }
.data-scroll::-webkit-scrollbar-button, .view-scroll::-webkit-scrollbar-button, .main-view::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
.data-scroll::-webkit-scrollbar-track, .view-scroll::-webkit-scrollbar-track, .main-view::-webkit-scrollbar-track { background: transparent; }
.data-scroll::-webkit-scrollbar-thumb, .view-scroll::-webkit-scrollbar-thumb, .main-view::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; }
.data-scroll::-webkit-scrollbar-corner { background: transparent; }
.view-scroll > :last-child { margin-bottom: 0 !important; }
@media (max-width: 900px) {
    .main-view { overflow-y: visible; }
    .view-panel { flex: 0 0 auto; }
    .view-scroll { flex: 0 0 auto; overflow-y: visible; }
    /* A table wider than the phone scrolls sideways in its card; the page itself never does */
    .data-scroll, .main-view .admin-table-wrap, .main-view .table-responsive { overflow-x: auto; overflow-y: hidden; }
    .view-panel > .data-card, .data-scroll { flex: 0 0 auto; }
}

/* ---------- user pages fit the window (user side: Home, team, account and sign-in pages) ---------- */
@media (min-width: 901px) {
    /* Home and a team's page: the app tiles scroll inside when there are many; the padding keeps their shadows */
    .app-main > .content-container > .home-apps,
    .app-main > .content-container > .app-tiles { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: -6px -10px 0; padding: 6px 10px 14px; }

    /* Account and team settings: the side menu stays, the section scrolls inside */
    .app-main > .content-container > .settings-shell { flex: 1 1 0; min-height: 0; grid-template-rows: minmax(0, 1fr); }
    .app-main > .content-container > .account-view { flex: 1 1 0; min-height: 0; overflow-y: auto; margin: -6px -10px 0; padding: 6px 10px 14px; }
    .settings-shell > .section-content { align-self: stretch; min-height: 0; overflow-y: auto; margin: -6px -10px 0; padding: 6px 10px 14px; }
}

/* Sign-in pages: the card fits the window; on a short window its spacing tightens */
.auth-layout { padding-bottom: 0; }
@media (min-width: 901px) and (max-height: 860px) {
    .auth-layout { padding-top: 3vh; }
    .auth-wordmark { margin-bottom: 18px; font-size: 30px; line-height: 38px; }
    .auth-apps { margin-top: 20px; }
    .auth-card { padding: 1.6rem 2rem 1.4rem; }
    .auth-card .btn:not(.btn-sm) { padding-top: 9px; padding-bottom: 9px; }
    .auth-sub { margin-bottom: 1.1rem; }
    .auth-divider { margin: 12px 0; }
    .provider-buttons { gap: 8px; }
    .auth-links { margin-top: 1rem; padding-top: .8rem; }
}

/* ---------- product names: dark text everywhere, the logo carries the product's colour (an accent like the Rhino Sync
   green is unreadable as text on white). Only the product page's colour preview shows the accent. ---------- */
.app-name { color: var(--text) !important; }
.plan-name.free { color: var(--text-dim) !important; }
.colour-preview .app-name, .colour-preview .plan-name { color: inherit !important; }
/* A product's plans (admin, Products > a product > Plans): the names in the product's colours (<PlanName>) */
.plan-colours .app-name, .plan-colours .plan-name { color: var(--name-colour, var(--text)) !important; }
.plan-colours .plan-name.free { color: var(--name-colour, var(--text-dim)) !important; }

/* A table row that opens its item */
.data-table tr.row-link { cursor: pointer; }
.data-table tr.row-link:hover > td { background: var(--bg-alt); }

/* A licence's billing cycle beside its plan: Monthly or Yearly */
.cycle-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 16px; vertical-align: 1px; background: var(--bg-2, #f1f3f5); color: var(--text-dim, #667085); }
.cycle-badge.yearly { background: var(--b-green-bg); color: var(--b-green-fg); }
.cycle-badge.monthly { background: var(--b-indigo-bg); color: var(--b-indigo-fg); }
/* A licence's type in the admin's lists (Components/Controls/LicenceTypeBadge.razor): one colour per type */
.type-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; vertical-align: 1px; background: var(--bg-2, #f1f3f5); color: var(--text-dim, #667085); }
.type-badge.stripe { background: var(--b-indigo-bg); color: var(--b-indigo-fg); }
.type-badge.manual { background: var(--b-green-bg); color: var(--b-green-fg); }
.type-badge.reseller { background: var(--b-teal-bg); color: var(--b-teal-fg); }
.type-badge.trial { background: var(--b-amber-bg); color: var(--b-amber-fg); }
.type-badge.educational { background: var(--cyan-tint); color: var(--cyan-ink); }
.type-badge.complimentary { background: var(--b-pink-bg); color: var(--b-pink-fg); }
.type-badge.granted { background: var(--b-purple-bg); color: var(--b-purple-fg); }
.type-badge + .type-badge { margin-left: 4px; }
.app-stack ~ .type-badge { margin-left: 6px; vertical-align: middle; }
/* A team role (Components/Controls/RoleBadge.razor), the same shape as the type badge: Owner, Admin, Member */
.role-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; vertical-align: 1px; letter-spacing: 0; background: var(--bg-2, #f1f3f5); color: var(--text-dim, #667085); }
.role-badge.owner { background: var(--b-indigo-bg); color: var(--b-indigo-fg); }
.role-badge.admin { background: var(--cyan-tint); color: var(--cyan-ink); }
.org-link + .role-badge, .team-link > a + .role-badge { margin-left: 6px; }

/* The admin's theme switch (Components/Controls/ThemeSwitch.razor): three icons on a grey track */
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--chip-bg); }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--text-faint); }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.theme-switch .material-symbols-outlined { font-size: 16px; }

/* One height for a row of controls: text boxes, dropdowns and buttons are 36px, their small versions 32px */
.btn:not(.btn-link), .mks-select-button { min-height: 36px; }
input.form-control:not([type="file"]):not([type="color"]), select.form-select { height: 36px; }
.mks-select-button { line-height: 20px; }
.btn-sm:not(.btn-link), .mks-select.sm .mks-select-button { min-height: 32px; }
input.form-control-sm:not([type="file"]):not([type="color"]), select.form-select-sm { height: 32px; padding-top: 5px; padding-bottom: 5px; font-size: 13.5px; line-height: 20px; }
.mks-select.sm .mks-select-button { line-height: 20px; }

/* The arrow in a change, "Pro → Team" (Components/Controls/ChangeArrow.razor): an icon, a little lighter than the text */
.change-arrow.material-symbols-outlined { font-size: 1.05em; vertical-align: -0.17em; margin: 0 3px; opacity: .6; line-height: 1; }
.theme-switch.with-labels { padding: 3px; }
.theme-switch.with-labels button { width: auto; height: 30px; gap: 6px; padding: 0 12px; font-size: 13.5px; font-weight: 500; }
.theme-switch.with-labels button.active { font-weight: 600; }
.theme-switch.with-labels .material-symbols-outlined { font-size: 17px; }
.account-row > .theme-action { margin-left: auto; }

/* A name above its detail (a person and their email in a table cell): always two lines */
.stacked { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stacked-main { font-weight: 500; }
.stacked-sub { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
