/* ==========================================================================
   KABC Payment Tools — fintech theme on top of Fluent UI Blazor v5
   Navy chrome, "blurple" brand (#635BFF), soft canvas, white rounded cards.
   Every color is a token below, redefined for dark mode.
   ========================================================================== */

/* ── Design tokens ─────────────────────────────────────────────────────── */

body {
    /* Brand */
    --app-brand: #635bff;
    --app-brand-hover: #5349ec;
    --app-brand-pressed: #4338ca;
    --app-brand-soft: #eef0ff;
    --app-brand-soft-border: #dcdfff;
    --app-brand-strong: #4338ca;

    /* Chrome (header brand block + sidebar) */
    --app-navy: #0b1324;
    --app-navy-2: #111c33;
    --app-navy-line: rgba(255, 255, 255, .07);
    --app-sidebar-text: #aab4cc;
    --app-sidebar-text-strong: #f1f4fb;
    --app-sidebar-muted: #6b7799;

    /* Surfaces & text */
    --app-canvas: #f4f6fb;
    --app-surface: #ffffff;
    --app-surface-2: #f8f9fd;
    --app-border: #e5e9f2;
    --app-border-strong: #d4dae7;
    --app-text: #0f172a;
    --app-text-2: #475569;
    --app-text-3: #8391a7;

    --app-radius-sm: 8px;
    --app-radius: 12px;
    --app-radius-lg: 16px;
    --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --app-shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .06);
    --app-shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, .22);

    /* Fluent tokens: brand, rounder controls, typography */
    --colorBrandBackground: var(--app-brand);
    --colorBrandBackgroundHover: var(--app-brand-hover);
    --colorBrandBackgroundPressed: var(--app-brand-pressed);
    --colorBrandBackgroundSelected: var(--app-brand-hover);
    --colorCompoundBrandBackground: var(--app-brand);
    --colorCompoundBrandBackgroundHover: var(--app-brand-hover);
    --colorCompoundBrandBackgroundPressed: var(--app-brand-pressed);
    --colorCompoundBrandStroke: var(--app-brand);
    --colorCompoundBrandStrokeHover: var(--app-brand-hover);
    --colorCompoundBrandStrokePressed: var(--app-brand-pressed);
    --colorCompoundBrandForeground1: var(--app-brand);
    --colorBrandForeground1: var(--app-brand-hover);
    --colorBrandForeground2: var(--app-brand-pressed);
    --colorBrandForegroundLink: var(--app-brand-hover);
    --colorBrandForegroundLinkHover: var(--app-brand-pressed);
    --colorBrandStroke1: var(--app-brand);
    --colorBrandBackground2: var(--app-brand-soft);

    --borderRadiusMedium: 8px;
    --borderRadiusLarge: 12px;
    --borderRadiusXLarge: 16px;
    --fontFamilyBase: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --fontFamilyMonospace: "Cascadia Mono", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;

    background-color: var(--app-canvas);
    color: var(--app-text);
    font-family: var(--fontFamilyBase);
    -webkit-font-smoothing: antialiased;
}

body[data-theme="dark"] {
    --app-brand: #7a73ff;
    --app-brand-hover: #8d87ff;
    --app-brand-pressed: #a5a0ff;
    --app-brand-soft: rgba(122, 115, 255, .14);
    --app-brand-soft-border: rgba(122, 115, 255, .30);
    --app-brand-strong: #b4b0ff;

    --app-navy: #070d1a;
    --app-navy-2: #0c1527;

    --app-canvas: #0a0f1c;
    --app-surface: #111a2c;
    --app-surface-2: #0d1526;
    --app-border: #1e2a42;
    --app-border-strong: #2a3854;
    --app-text: #e7ebf4;
    --app-text-2: #aab4c8;
    --app-text-3: #6f7c95;

    --app-shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --app-shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .5);
    --app-shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, .6);
}

h1:focus {
    outline: none;
}

a {
    color: var(--colorBrandForegroundLink);
}

/* ── Shell: header ─────────────────────────────────────────────────────── */

.app-shell .fluent-layout-item[area="header"] {
    padding: 0;
    background: transparent;
    color: var(--app-text);
}

.app-header {
    display: grid;
    grid-template-columns: 264px 1fr;
    width: 100%;
    height: 60px;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: var(--spacingHorizontalS);
    padding: 0 var(--spacingHorizontalL);
    background: var(--app-navy);
    border-bottom: 1px solid var(--app-navy-line);
}

    .app-header-brand .fluent-layout-hamburger {
        color: #fff;
        fill: #fff;
    }

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff !important;
    text-decoration: none;
}

.app-brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #e9e7ff 100%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 14px -6px rgba(99, 91, 255, .7);
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .02em;
}

.app-brand-sub {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--app-sidebar-text);
}

.app-header-bar {
    display: flex;
    align-items: center;
    gap: var(--spacingHorizontalS);
    padding: 0 var(--spacingHorizontalXXL);
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
}

.fluent-layout[mobile] .app-header {
    grid-template-columns: auto 1fr;
}

.fluent-layout[mobile] .app-header-brand {
    padding: 0 var(--spacingHorizontalS);
}

.fluent-layout[mobile] .app-brand-text,
.fluent-layout[mobile] .tool-search-kbd {
    display: none;
}

.fluent-layout[mobile] .app-header-bar {
    padding: 0 var(--spacingHorizontalM);
}

/* Header tool search */
.tool-search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(420px, 100%);
}

.tool-search-icon {
    position: absolute;
    left: 12px;
    display: flex;
    color: var(--app-text-3);
    pointer-events: none;
}

.tool-search-input {
    width: 100%;
    height: 38px;
    padding: 0 64px 0 36px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: var(--app-surface-2);
    color: var(--app-text);
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

    .tool-search-input::placeholder {
        color: var(--app-text-3);
    }

    .tool-search-input:focus {
        background: var(--app-surface);
        border-color: var(--app-brand);
        box-shadow: 0 0 0 3px var(--app-brand-soft);
    }

    .tool-search-input::-webkit-search-cancel-button {
        display: none;
    }

.tool-search-kbd {
    position: absolute;
    right: 10px;
    padding: 1px 6px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: var(--app-surface);
    color: var(--app-text-3);
    font-family: var(--fontFamilyBase);
    font-size: 11px;
    pointer-events: none;
}

.tool-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 200;
    padding: 6px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-lg);
}

.tool-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--app-radius-sm);
    color: var(--app-text) !important;
    text-decoration: none;
}

    .tool-search-item.active {
        background: var(--app-brand-soft);
    }

.tool-search-item-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.tool-search-item-title {
    font-weight: 600;
    font-size: 14px;
}

.tool-search-item-cat {
    font-size: 12px;
    color: var(--app-text-3);
}

.tool-search-empty {
    padding: 12px;
    color: var(--app-text-3);
    font-size: 13px;
}

/* User chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text);
    font: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

    .user-chip:hover {
        background: var(--app-surface-2);
        border-color: var(--app-border-strong);
    }

.user-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--app-brand) 0%, #9a3fe0 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}

.user-chip-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.user-chip-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

.user-chip-role {
    font-size: 11px;
    color: var(--app-text-3);
}

@media (max-width: 900px) {
    .user-chip-text { display: none; }
    .user-chip { padding: 3px; }
}

/* ── Shell: sidebar ────────────────────────────────────────────────────── */

.app-shell .fluent-layout-item[area="nav"] {
    background: var(--app-navy);
    border-right: 1px solid var(--app-navy-line);
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: var(--spacingVerticalM) 10px var(--spacingVerticalL);
    background: var(--app-navy);
    color-scheme: dark;
    /* Fluent nav tokens, dark variant */
    --nav-bg-color: transparent;
    --nav-bg-color-hover: rgba(255, 255, 255, .06);
    --colorNeutralForeground1: var(--app-sidebar-text-strong);
    --colorNeutralForeground2: var(--app-sidebar-text);
    --colorBrandForeground1: #ffffff;
    --colorCompoundBrandForeground1: var(--app-brand);
    --colorStrokeFocus2: #ffffff;
}

/* Hamburger drawer (mobile) shows the same sidebar. */
fluent-drawer-body:has(.sidebar) {
    padding: 0;
    background: var(--app-navy);
}

.sidebar .fluent-nav {
    flex: 0 0 auto;
    padding: 0;
    border: none;
    overflow: visible;
    row-gap: 2px;
}

.sidebar .fluent-navitem,
.sidebar .fluent-navsubitem,
.sidebar .fluent-navcategoryitem {
    border-radius: 8px;
    font-size: 14px;
    align-items: center;
}

.sidebar .fluent-navsubitem {
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 13.5px;
}

    .sidebar .fluent-navitem.active,
    .sidebar .fluent-navsubitem.active {
        background: linear-gradient(90deg, rgba(99, 91, 255, .28) 0%, rgba(99, 91, 255, .10) 100%);
        color: #ffffff;
    }

.sidebar .fluent-navitem.active:after,
.sidebar .fluent-navsubitem.active:after {
    width: 3px;
    background-color: #8d87ff;
}

.sidebar .fluent-navsectionheader {
    margin: 18px 0 6px 12px;
    color: var(--app-sidebar-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sidebar .fluent-navcategoryitem > .expand-icon {
    color: var(--app-sidebar-muted);
}

/* Links to the other KABC sites, above the Support card: quiet, so they do not compete with the tools. */
.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: auto;
    padding: 12px 4px 10px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-links-title {
    padding: 0 8px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--app-sidebar-text);
    opacity: .75;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--app-sidebar-text) !important;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}

    .sidebar-link:hover,
    .sidebar-link:focus-visible {
        background: rgba(255, 255, 255, .06);
        color: var(--app-sidebar-text-strong) !important;
    }

    .sidebar-link > span {
        flex: 1;
    }

    .sidebar-link fluent-icon,
    .sidebar-link svg {
        color: currentColor;
        fill: currentColor;
    }

.sidebar-link-external {
    opacity: .6;
}

.sidebar-links + .sidebar-cta {
    margin-top: 8px;
}

.sidebar-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--app-radius);
    background: linear-gradient(135deg, rgba(99, 91, 255, .22) 0%, rgba(154, 63, 224, .14) 100%);
    color: var(--app-sidebar-text-strong) !important;
    text-decoration: none;
    transition: border-color .15s, transform .15s;
}

    .sidebar-cta:hover {
        border-color: rgba(255, 255, 255, .2);
        transform: translateY(-1px);
    }

.sidebar-cta-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .1);
    color: #ff7aa2;
}

.sidebar-cta-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.sidebar-cta-text {
    display: block;
    font-size: 12px;
    color: var(--app-sidebar-text);
}

/* ── Shell: content ────────────────────────────────────────────────────── */

.app-shell .fluent-layout-item[area="content"] {
    background: var(--app-canvas);
    display: flex;
    flex-direction: column;
}

/* Page width: the page fills the window beside the navigation; the header toggle switches to a centered
   1440px column (html[data-width="column"], remembered as kabc.pageWidth). The toggle is hidden on windows
   too narrow for the column to make a difference (1440px + the 264px navigation). Side padding grows gently
   with the window. */
:root {
    --app-page-max: none;
    --app-page-pad: clamp(16px, 2.2vw, 48px);
}

html[data-width="column"] {
    --app-page-max: 1440px;
}

@media (max-width: 1759.98px) {
    .width-toggle {
        display: none;
    }
}

.app-page {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--app-page-max);
    margin: 0 auto;
    padding: 28px var(--app-page-pad) 32px;
}

.app-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    max-width: var(--app-page-max);
    margin: 0 auto;
    padding: 16px var(--app-page-pad) 24px;
    border-top: 1px solid var(--app-border);
    color: var(--app-text-3);
    font-size: 12.5px;
}

    .app-footer a {
        color: var(--app-text-2);
        text-decoration: none;
    }

        .app-footer a:hover {
            color: var(--app-brand);
        }

.app-footer-dot {
    opacity: .6;
}

.app-footer-version {
    font-family: var(--fontFamilyMonospace);
}

@media (max-width: 768px) {
    .app-page { padding: 18px 14px 24px; }
    .app-footer { padding: 14px; }
}

/* ── Page header (catalog pages) ───────────────────────────────────────── */

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.page-head-text {
    min-width: 0;
}

.page-crumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--app-text-3);
}

    .page-crumb a {
        color: var(--app-text-3);
        text-decoration: none;
    }

        .page-crumb a:hover {
            color: var(--app-brand);
        }

.page-title {
    margin: 2px 0 4px;
    font-size: 26px;
    line-height: 34px;
    font-weight: 650;
    letter-spacing: -.015em;
    color: var(--app-text);
}

.page-desc {
    margin: 0;
    max-width: 760px;
    color: var(--app-text-2);
    font-size: 14.5px;
}

@media (max-width: 768px) {
    .page-title { font-size: 21px; line-height: 28px; }
}

/* ── Icon tiles & category accents ─────────────────────────────────────── */

.tile-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--accent-bg, var(--app-brand-soft));
    color: var(--accent, var(--app-brand));
}

.tile-icon-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.tile-icon-lg {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.accent-indigo  { --accent: #5b54f0; --accent-bg: #eeedff; }
.accent-amber   { --accent: #c26a06; --accent-bg: #fff3df; }
.accent-emerald { --accent: #05875e; --accent-bg: #e3f7ef; }
.accent-sky     { --accent: #0276b8; --accent-bg: #e2f2fc; }
.accent-slate   { --accent: #475569; --accent-bg: #edf0f5; }
.accent-rose    { --accent: #d6194a; --accent-bg: #ffe8ee; }
.accent-violet  { --accent: #8a3ffc; --accent-bg: #f3ecff; }
.accent-teal    { --accent: #0b7a75; --accent-bg: #e0f5f3; }
.accent-orange  { --accent: #c2410c; --accent-bg: #fff1e6; }

body[data-theme="dark"] .accent-indigo  { --accent: #a29dff; --accent-bg: rgba(122, 115, 255, .16); }
body[data-theme="dark"] .accent-amber   { --accent: #f6b552; --accent-bg: rgba(246, 181, 82, .14); }
body[data-theme="dark"] .accent-emerald { --accent: #4fd6a3; --accent-bg: rgba(79, 214, 163, .14); }
body[data-theme="dark"] .accent-sky     { --accent: #62bff2; --accent-bg: rgba(98, 191, 242, .14); }
body[data-theme="dark"] .accent-slate   { --accent: #b3bfd2; --accent-bg: rgba(179, 191, 210, .12); }
body[data-theme="dark"] .accent-rose    { --accent: #ff7f9f; --accent-bg: rgba(255, 127, 159, .14); }
body[data-theme="dark"] .accent-violet  { --accent: #be95ff; --accent-bg: rgba(190, 149, 255, .14); }
body[data-theme="dark"] .accent-teal    { --accent: #4dd4c8; --accent-bg: rgba(77, 212, 200, .14); }
body[data-theme="dark"] .accent-orange  { --accent: #fb923c; --accent-bg: rgba(251, 146, 60, .14); }

/* ── Panels (top-level ToolCard) & sections (nested ToolCard) ──────────── */

.panel {
    margin-bottom: 20px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--app-border);
}

.panel-head-actions-only {
    justify-content: flex-end;
    padding: 12px 24px;
}

.panel-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--app-brand-soft);
    color: var(--app-brand);
}

.panel-title {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 650;
    color: var(--app-text);
}

.panel-actions {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: var(--spacingHorizontalS);
}

.panel-body {
    padding: 22px 24px 24px;
}

.section-card {
    height: 100%;
    margin-bottom: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-2);
}

.section-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 0;
}

.section-card-icon {
    color: var(--app-text-3);
}

.section-card-title {
    margin: 0;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--app-text-3);
}

.section-card-actions {
    margin-inline-start: auto;
}

.section-card-body {
    padding: 10px 16px 14px;
}

.panel-body > .section-card,
.panel-body > * > .section-card {
    margin-bottom: 14px;
}

@media (max-width: 768px) {
    .panel-head { padding: 14px 16px; }
    .panel-body { padding: 16px; }
}

/* Responsive columns (replaces Blazorise Row/Column) */
.cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
    .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

/* ── Forms (InputGroup replaces Blazorise Field + Addons) ──────────────── */

.input-group {
    margin-bottom: 16px;
}

.input-group-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text);
}

.input-group-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.input-group-control {
    flex: 1 1 auto;
    min-width: 0;
}

    .input-group-control > *,
    .input-group-control fluent-field,
    .input-group-control fluent-text-input,
    .input-group-control fluent-textarea,
    .input-group-control fluent-dropdown,
    .input-group-control fluent-spin-button {
        width: 100%;
        max-width: 100%;
    }

    .input-group-control fluent-field {
        margin: 0;
    }

    /* Single-line height by default so text areas line up with the chips; auto-resize grows them. */
    .input-group-control fluent-textarea {
        --min-block-size: 32px;
    }

/* Narrow screens: the input takes the full row and the chips/actions wrap below it. */
@media (max-width: 640px) {
    .input-group-row { flex-wrap: wrap; }
    .input-group-control { flex-basis: 100%; }
}

.input-group-help {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--app-text-3);
}

/* Value chips next to inputs: [len][KCV][parity] */
.addon {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--app-brand-soft-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-brand-soft);
    color: var(--app-brand-strong);
    font-family: var(--fontFamilyMonospace);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.TR31-Start,
.RSACert {
    min-width: 150px;
    justify-content: flex-start;
    border-color: var(--app-border);
    background: var(--app-surface-2);
    color: var(--app-text-2);
    font-family: var(--fontFamilyBase);
    font-weight: 600;
}

.RSACert { min-width: 140px; }

/* Monospace values (was .FormatMemEdit). Only the font changes: the Fluent textarea keeps
   pre-wrap inside its shadow DOM, and white-space on the field wrapper would render Blazor's
   whitespace text nodes as blank lines. */
.mono:not(fluent-field),
.FormatMemEdit:not(fluent-field),
fluent-field.mono > fluent-textarea,
fluent-field.mono > fluent-text-input,
fluent-field.FormatMemEdit > fluent-textarea {
    --fontFamilyBase: var(--fontFamilyMonospace);
    font-family: var(--fontFamilyMonospace);
}

.FormatCheck {
    font-family: var(--fontFamilyMonospace);
    white-space: pre;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: center;
}

.dash_buttons {
    width: 220px;
}

/* Plain HTML inputs (native form posts, time/date pickers) styled like Fluent inputs. */
.native-input {
    width: 100%;
    min-height: 36px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    color: var(--app-text);
    background-color: var(--app-surface);
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

    .native-input:hover {
        border-color: var(--app-text-3);
    }

    .native-input:focus {
        border-color: var(--app-brand);
        box-shadow: 0 0 0 3px var(--app-brand-soft);
    }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.button-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 4px;
    padding-top: 18px;
    border-top: 1px dashed var(--app-border);
}

.button-bar-start { justify-content: flex-start; }
.button-bar-end { justify-content: flex-end; }

.section-card .button-bar,
.button-bar.mt-0 {
    border-top: none;
    padding-top: 0;
    margin-top: 8px;
}

fluent-button, fluent-anchor-button {
    font-weight: 600;
}

/* Semantic tones for Primary-appearance buttons (Blazorise Color.Danger/Warning/Success/Info). */
.tone-danger {
    --colorBrandBackground: #dc2647;
    --colorBrandBackgroundHover: #c11e3d;
    --colorBrandBackgroundPressed: #a51733;
}

.tone-warning {
    --colorBrandBackground: #e07a0b;
    --colorBrandBackgroundHover: #c76b07;
    --colorBrandBackgroundPressed: #a85a06;
}

.tone-success {
    --colorBrandBackground: #0c9b6a;
    --colorBrandBackgroundHover: #08875c;
    --colorBrandBackgroundPressed: #06714d;
}

.tone-info {
    --colorBrandBackground: #0b84c6;
    --colorBrandBackgroundHover: #0973ad;
    --colorBrandBackgroundPressed: #076292;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.tool-tabs {
    margin: -6px 0 6px;
}

    .tool-tabs > .fluent-tab-panel {
        padding-top: 18px;
        border-top: 1px solid var(--app-border);
    }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--app-radius);
}

.data-table,
table.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    overflow: hidden;
    font-size: 13.5px;
    background: var(--app-surface);
}

    .data-table th,
    table.table th {
        background-color: var(--app-surface-2);
        color: var(--app-text-3);
        font-size: 11.5px;
        font-weight: 650;
        letter-spacing: .05em;
        text-transform: uppercase;
        text-align: left;
        border-bottom: 1px solid var(--app-border);
    }

    .data-table td,
    table.table td {
        border-bottom: 1px solid var(--app-border);
        color: var(--app-text);
    }

    .data-table tbody tr:last-child td,
    table.table tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table.striped tbody tr:nth-child(even) {
        background-color: var(--app-surface-2);
    }

    .data-table.hover tbody tr:hover,
    table.table-hover tbody tr:hover {
        background-color: var(--app-brand-soft);
    }

    .data-table.bordered td,
    .data-table.bordered th,
    table.table-bordered td,
    table.table-bordered th {
        border-right: 1px solid var(--app-border);
    }

    .data-table.compact td,
    .data-table.compact th,
    table.table-sm td,
    table.table-sm th {
        padding: 6px 10px;
    }

    .data-table tfoot td {
        font-weight: 600;
        background-color: var(--app-surface-2);
        border-top: 1px solid var(--app-border);
    }

.data-table.borderless,
.data-table.borderless td,
.data-table.borderless th {
    border: none;
    border-radius: 0;
    background: transparent;
}

/* ── Feedback ──────────────────────────────────────────────────────────── */

fluent-message-bar {
    border-radius: var(--app-radius-sm);
}

.error-text {
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid #f7c8d3;
    border-radius: var(--app-radius-sm);
    background: #fff1f4;
    color: #b4123c;
    font-size: 13.5px;
}

body[data-theme="dark"] .error-text {
    border-color: rgba(255, 127, 159, .3);
    background: rgba(255, 127, 159, .1);
    color: #ff9db5;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 40px 16px;
    color: var(--app-text-3);
}

/* ── Dashboard ─────────────────────────────────────────────────────────── */

.hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    overflow: hidden;
    margin-bottom: 28px;
    padding: 36px 40px;
    border-radius: 20px;
    background:
        radial-gradient(900px 300px at 85% -10%, rgba(154, 63, 224, .45), transparent 60%),
        radial-gradient(700px 320px at 0% 120%, rgba(99, 91, 255, .45), transparent 60%),
        linear-gradient(135deg, #0b1324 0%, #142046 55%, #1d1a52 100%);
    color: #fff;
    box-shadow: var(--app-shadow-lg);
}

.hero-content {
    position: relative;
    max-width: 660px;
}

.hero-eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #d9d6ff;
}

.hero-title {
    margin: 0 0 10px;
    font-size: 34px;
    line-height: 42px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #fff;
}

.hero-lead {
    margin: 0 0 22px;
    font-size: 15.5px;
    line-height: 1.6;
    color: #c5cbe0;
}

.hero-search {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 520px;
    padding: 0 14px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    color: #c5cbe0;
    transition: background .15s, border-color .15s;
}

    .hero-search:focus-within {
        background: rgba(255, 255, 255, .14);
        border-color: rgba(165, 160, 255, .8);
    }

    .hero-search input {
        flex: 1;
        min-width: 0;
        height: 100%;
        border: none;
        outline: none;
        background: transparent;
        color: #fff;
        font: inherit;
        font-size: 15px;
    }

        .hero-search input::placeholder {
            color: #9aa3c2;
        }

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-top: 24px;
}

.hero-stat {
    display: flex;
    flex-direction: column;
}

.hero-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.hero-stat-label {
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #9aa3c2;
}

.hero-art {
    position: relative;
    align-self: center;
    width: 200px;
    height: 200px;
    opacity: .9;
}

    .hero-art img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        filter: brightness(1.15) saturate(1.1) drop-shadow(0 20px 40px rgba(99, 91, 255, .45));
    }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding: 28px 22px; }
    .hero-art { display: none; }
    .hero-title { font-size: 26px; line-height: 33px; }
}

.tool-section {
    margin-bottom: 28px;
}

.tool-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.tool-section-title {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
    color: var(--app-text);
}

.tool-section-count {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    font-size: 12px;
    color: var(--app-text-3);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.tool-tile {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 36px 16px 16px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
    color: var(--app-text) !important;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

    .tool-tile:hover {
        transform: translateY(-2px);
        border-color: var(--app-brand-soft-border);
        box-shadow: var(--app-shadow-md);
    }

    .tool-tile:focus-visible {
        outline: 2px solid var(--app-brand);
        outline-offset: 2px;
    }

.tool-tile-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.tool-tile-title {
    font-size: 14.5px;
    font-weight: 650;
}

.tool-tile-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.45;
    color: var(--app-text-2);
}

.tool-tile-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    line-height: 1;
    color: var(--app-text-3);
    transition: transform .15s ease, color .15s ease;
}

.tool-tile:hover .tool-tile-arrow {
    color: var(--app-brand);
    transform: translate(3px, -50%);
}

.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-top: 8px;
}

.about-title {
    margin: 10px 0 8px;
    font-size: 17px;
    font-weight: 650;
}

.about-card .about-title {
    margin-top: 0;
}

.about-lead { margin: 12px 0 6px; font-weight: 600; }
.about-features { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
    .about-features li { display: flex; gap: 10px; align-items: flex-start; }
    .about-features li > svg, .about-features li > .fluent-icon { flex: none; margin-top: 2px; color: var(--app-brand); }
.support-price { font-size: 26px; font-weight: 800; line-height: 1.1; margin: 4px 0 2px; }
    .support-price span { font-size: 14px; font-weight: 500; color: var(--app-text-2); }
.support-points { margin: 8px 0 14px; padding-left: 18px; color: var(--app-text-2); font-size: 13.5px; }
    .support-points li { margin: 3px 0; }
.support-note { margin: 10px 0 0; font-size: 12.5px; color: var(--app-text-3); }

.support-card {
    background:
        radial-gradient(400px 200px at 100% 0%, rgba(214, 25, 74, .08), transparent 70%),
        var(--app-surface);
}

@media (max-width: 900px) {
    .about-grid { grid-template-columns: 1fr; }
}

/* ── Auth pages ────────────────────────────────────────────────────────── */

.auth-wrap {
    max-width: 440px;
    margin: 24px auto;
}

    .auth-wrap .panel {
        box-shadow: var(--app-shadow-md);
    }

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.auth-brand-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--app-text);
}

.auth-brand-sub {
    font-size: 13.5px;
    color: var(--app-text-2);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

    .auth-form .button-bar {
        border-top: none;
        padding-top: 0;
    }

/* ── Text & layout helpers ─────────────────────────────────────────────── */

.text-error { color: #c8133f; }
.text-success { color: #05875e; }
.text-warning { color: #c26a06; }
.text-muted { color: var(--app-text-3); }
.text-brand { color: var(--app-brand); }
body[data-theme="dark"] .text-error { color: #ff8aa6; }
body[data-theme="dark"] .text-success { color: #4fd6a3; }
body[data-theme="dark"] .text-warning { color: #f6b552; }
.text-center { text-align: center; }
.text-end { text-align: end; }
.fw-bold { font-weight: 650; }
.small { font-size: 12.5px; }
.font-monospace { font-family: var(--fontFamilyMonospace); }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.gap-1 { gap: var(--spacingHorizontalXS); }
.gap-2 { gap: var(--spacingHorizontalS); }
.gap-3 { gap: var(--spacingHorizontalM); }
.w-100 { width: 100%; }

/* All-sides spacing (Fluent ships the directional mt-/mb-/px-… utilities only). */
.m-0 { margin: 0 !important; }
.m-1 { margin: var(--spacingVerticalXS) !important; }
.m-2 { margin: var(--spacingVerticalS) !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacingVerticalXS) !important; }
.p-2 { padding: var(--spacingVerticalS) !important; }
.p-3 { padding: var(--spacingVerticalM) !important; }

/* ── EMV TLV tree / decoders ───────────────────────────────────────────── */

.chip {
    display: inline-block;
    min-width: 2.5em;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--app-border);
    background-color: var(--app-surface-2);
    color: var(--app-text-2);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    white-space: nowrap;
}

.emv-decoded-box {
    padding: 10px 14px;
    border-radius: var(--app-radius-sm);
    border: 1px solid var(--app-border);
    background-color: var(--app-surface-2);
}

/* ── Bootstrap compatibility for the few raw-HTML lists kept from DevKit ── */

.list-group { list-style: none; margin: 0; padding: 0; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); }
.list-group > li { padding: 8px 14px; border-bottom: 1px solid var(--app-border); }
.list-group > li:last-child { border-bottom: none; }
.text-secondary { color: var(--app-text-3); }
.fw-semibold { font-weight: 600; }
.bg-light { background-color: var(--app-surface-2); }
.border { border: 1px solid var(--app-border); }
.border-bottom { border-bottom: 1px solid var(--app-border); }
.rounded { border-radius: var(--app-radius-sm); }
.justify-content-end { justify-content: flex-end; }
.align-items-baseline { align-items: baseline; }

/* ── Blazor framework UI ───────────────────────────────────────────────── */

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ── Brand link doubles as the dashboard entry ─────────────────────────── */

.app-brand {
    margin: -4px -8px;
    padding: 4px 8px;
    border-radius: 12px;
    transition: background-color .15s ease;
}

    .app-brand:hover,
    .app-brand:focus-visible {
        background-color: rgba(255, 255, 255, .07);
    }

/* ── PKI workbench (RSA / ECC pages) ───────────────────────────────────── */

.pki-tabs {
    margin-bottom: 4px;
}

    .pki-tabs > .fluent-tab-panel {
        padding-top: 18px;
    }

.tool-page {
    container: pki / inline-size;
}

.tool-page .cols {
    gap: 20px;
    margin-bottom: 20px;
}

/* Side-by-side cards stack before they get too narrow for a 64-character PEM line. */
@container pki (max-width: 960px) {
    .tool-page .cols-2:not(.panel-body .cols-2) { grid-template-columns: minmax(0, 1fr); }
}

/* Certificate result: PEM beside the decoded details only when both have room. */
@container (max-width: 900px) {
    .tool-page .panel-body .cert-result { grid-template-columns: minmax(0, 1fr); }
}

    .tool-page .cols > .panel {
        margin-bottom: 0;
    }

.tool-page .panel-body > .cols:last-child,
.tool-page .panel-body > .input-group:last-child {
    margin-bottom: 0;
}

.hint {
    margin: 0 0 12px;
    font-size: 12.5px;
    line-height: 18px;
    color: var(--app-text-3);
}

/* Segmented control (pill buttons) */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: var(--app-surface-2);
}

.segmented-item {
    min-height: 30px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--app-text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

    .segmented-item:hover {
        color: var(--app-text);
    }

    .segmented-item.active {
        background: var(--app-surface);
        color: var(--app-brand-strong);
        box-shadow: var(--app-shadow-sm);
    }

    .segmented-item:focus-visible {
        outline: 2px solid var(--app-brand);
        outline-offset: 1px;
    }

body[data-theme="dark"] .segmented-item.active {
    background: var(--app-brand-soft);
}

.cert-modes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 14px 20px;
}

    .cert-modes .hint {
        margin: 0;
    }

/* Native "Text / Hex / Base64" picker in front of an input */
.format-select {
    min-height: 32px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--app-brand-soft-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23635bff' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center;
    color: var(--app-brand-strong);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    appearance: none;
    cursor: pointer;
}

    .format-select:focus-visible {
        outline: 2px solid var(--app-brand);
        outline-offset: 1px;
    }

.jose-alg {
    font-weight: 700;
    letter-spacing: .03em;
}

/* PEM / signature output with copy & download */
.pem-output {
    margin-bottom: 16px;
    container-type: inline-size;
}

/* 64-character PEM lines fit the card: the font follows the card width (a monospace glyph is at most
   ~0.6em, so 64 chars ≈ 38.4em; 26px = padding + border). Below 10px the block scrolls sideways
   instead of breaking a line. */
.pem-block {
    margin: 0;
    max-height: 480px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-2);
    color: var(--app-text);
    font-family: var(--fontFamilyMonospace);
    font-size: clamp(10px, calc((100cqi - 26px) / 38.6), 13px);
    line-height: 1.55;
    white-space: pre;
    tab-size: 2;
}

    .pem-block:focus-visible {
        outline: 2px solid var(--app-brand);
        outline-offset: 1px;
    }

.pem-wrap {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pem-empty {
    min-height: 44px;
    color: var(--app-text-3);
}

/* Paste boxes for PEM: same width-fitted font, so pasted keys and certificates show 64 per line too.
   Long single-line input (JWK, Base64) still wraps. */
.pem-input-host {
    container-type: inline-size;
}

    .pem-input-host fluent-textarea::part(control) {
        font-family: var(--fontFamilyMonospace);
        font-size: clamp(10px, calc((100cqi - 30px) / 38.6), 13px);
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

.pem-output-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
}

    .pem-output-head .input-group-label {
        margin-bottom: 0;
    }

.pem-output-actions {
    display: inline-flex;
    gap: 2px;
}

/* Current key summary */
.key-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.key-summary-title {
    font-size: 15px;
    font-weight: 650;
    color: var(--app-text);
}

.key-summary-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.empty-key {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 16px;
    text-align: center;
    color: var(--app-text-3);
}

    .empty-key p {
        max-width: 420px;
        margin: 0;
    }

/* Label/value list for fingerprints, components and certificate fields */
.kv-list {
    display: grid;
    grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
    gap: 8px 16px;
    margin: 0;
    font-size: 13px;
}

    .kv-list dt {
        padding-top: 2px;
        color: var(--app-text-3);
        font-weight: 550;
    }

    .kv-list dd {
        display: flex;
        align-items: flex-start;
        gap: 4px;
        margin: 0;
        min-width: 0;
        color: var(--app-text);
    }

    .kv-list code {
        flex: 1 1 auto;
        min-width: 0;
        padding-top: 2px;
        font-family: var(--fontFamilyMonospace);
        font-size: 12px;
        word-break: break-all;
    }

    .kv-list dd > fluent-button {
        flex: none;
        margin-top: -6px;
    }

    .kv-list dd.chip-list {
        flex-wrap: wrap;
        gap: 6px;
    }

/* Stack label over value when the card (not the window) is narrow. */
.tool-page .panel-body {
    container-type: inline-size;
}

@container (max-width: 540px) {
    .kv-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .kv-list dt { padding-top: 0; font-size: 12px; }
    .kv-list dd { margin-bottom: 10px; }
}

/* Form grids inside PKI cards follow the card width too (cards sit side by side on wide screens). */
@container (max-width: 600px) {
    .tool-page .panel-body .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (max-width: 440px) {
    .tool-page .panel-body .cols-2,
    .tool-page .panel-body .cols-3 { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* File picker: a label wrapping a hidden <InputFile> */
.file-pick {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 32px;
    padding: 0 12px;
    border: 1px dashed var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-2);
    color: var(--app-text-2);
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

    .file-pick:hover {
        border-color: var(--app-brand);
        color: var(--app-brand-strong);
    }

    .file-pick input[type=file] {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
    }

.file-pick-inline {
    width: auto;
}

/* Decoded certificate / CSR */
.cert-info-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.cert-info-title {
    min-width: 0;
}

.cert-info-subject {
    font-size: 15px;
    font-weight: 650;
    color: var(--app-text);
    overflow-wrap: anywhere;
}

.cert-info-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.cert-list .panel {
    margin-bottom: 16px;
}

/* ── Page header: favorite star and "where does this run" ──────────────── */

.page-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fav-toggle {
    color: var(--app-text-3);
}

    .fav-toggle.on {
        color: #e0a100;
    }

.run-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 2px 10px 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    font-size: 12px;
    color: var(--app-text-2);
    cursor: help;
}

    .run-chip.run-local {
        border-color: rgba(16, 185, 129, .35);
        color: #047857;
        background: rgba(16, 185, 129, .08);
    }

    .run-chip.run-server {
        border-color: rgba(59, 130, 246, .35);
        color: #1d4ed8;
        background: rgba(59, 130, 246, .08);
    }

body[data-theme="dark"] .run-chip.run-local { color: #6ee7b7; }
body[data-theme="dark"] .run-chip.run-server { color: #93c5fd; }

/* ── Dashboard: favorites / recently used ──────────────────────────────── */

.quick-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    margin: 0 0 24px;
    padding: 14px 18px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.quick-group {
    min-width: 0;
}

.quick-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--app-text-3);
}

.quick-star {
    color: #e0a100;
}

.quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 9px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface-2);
    color: var(--app-text);
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}

    .quick-chip:hover {
        border-color: var(--app-brand);
        color: var(--app-brand-strong);
    }

.quick-hint {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--app-text-3);
}

kbd {
    display: inline-block;
    padding: 0 5px;
    border: 1px solid var(--app-border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--app-surface);
    font-family: var(--fontFamilyMonospace);
    font-size: 11px;
    line-height: 16px;
}

/* ── Privacy dialog ────────────────────────────────────────────────────── */

.privacy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--app-border);
}

/* ── ISO 8583 / EMV QR tables ──────────────────────────────────────────── */

.iso-table td {
    vertical-align: top;
}

.iso-value {
    font-family: var(--fontFamilyMonospace);
    word-break: break-all;
    min-width: 12ch;
}

.nowrap {
    white-space: nowrap;
}

.sub-row td {
    background: var(--app-surface-2);
    font-size: 12.5px;
}

.qr-box {
    width: min(100%, 260px);
    margin: 4px 0 12px;
    padding: 8px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
}

    .qr-box svg {
        display: block;
        width: 100%;
        height: auto;
    }

/* ── APDU decoder ──────────────────────────────────────────────────────── */

.apdu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apdu-item {
    padding: 10px 14px;
    border: 1px solid var(--app-border);
    border-left-width: 4px;
    border-radius: var(--app-radius-sm);
    background: var(--app-surface);
}

    .apdu-item.apdu-cmd {
        border-left-color: var(--app-brand);
    }

    .apdu-item.apdu-rsp {
        margin-left: 24px;
        border-left-color: #10b981;
        background: var(--app-surface-2);
    }

.apdu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.apdu-hex {
    display: block;
    font-family: var(--fontFamilyMonospace);
    font-size: 12px;
    color: var(--app-text-2);
    word-break: break-all;
}

.apdu-tlv {
    margin-top: 8px;
}

@media (max-width: 640px) {
    .apdu-item.apdu-rsp { margin-left: 8px; }
}

/* A closed dialog declared in the header must not take room in the toolbar row (open dialogs use the top layer). */
.app-header-bar > fluent-dialog {
    position: absolute;
}

/* ── Key input (TR-31 and other key tools) ─────────────────────────────── */

.key-input-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    margin-top: 4px;
    min-height: 32px;
}

.key-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
}

.key-fact {
    padding: 1px 8px;
    border: 1px solid var(--app-brand-soft-border);
    border-radius: 999px;
    background: var(--app-brand-soft);
    color: var(--app-brand-strong);
    font-family: var(--fontFamilyMonospace);
    font-size: 11.5px;
    white-space: nowrap;
}

    .key-fact.bad {
        border-color: rgba(220, 38, 38, .35);
        background: rgba(220, 38, 38, .08);
        color: #b91c1c;
    }

body[data-theme="dark"] .key-fact.bad { color: #fca5a5; }

.key-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

.key-random-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.key-random-label {
    margin-left: 6px;
    font-size: 11.5px;
    color: var(--app-text-3);
}

.key-random {
    min-width: 0;
    padding-inline: 6px;
    font-size: 12px;
    color: var(--app-brand-strong);
}

.tool-page .cols.tr31-fields {
    row-gap: 0;
}

/* ── TR-31 ─────────────────────────────────────────────────────────────── */

.tr31-preview {
    margin-top: 4px;
}

    .tr31-preview code {
        display: block;
        margin-top: 4px;
        padding: 8px 10px;
        border: 1px dashed var(--app-border-strong);
        border-radius: var(--app-radius-sm);
        font-family: var(--fontFamilyMonospace);
        font-size: 13px;
        word-break: break-all;
    }

.tr31-options {
    margin-bottom: 12px;
}

.tr31-warnings {
    margin: 0;
    padding-left: 18px;
}

.tr31-opt-table td {
    vertical-align: middle;
}

.tr31-id-select {
    width: 100%;
    max-width: 12em;
}

.tr31-id-input {
    width: 5em;
    margin-top: 4px;
}

.tr31-block {
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-2);
    font-family: var(--fontFamilyMonospace);
    font-size: 13.5px;
    line-height: 1.9;
    word-break: break-all;
}

.tr31-seg {
    padding: 2px 1px;
    border-radius: 3px;
}

    .tr31-seg + .tr31-seg {
        margin-left: 1px;
    }

.tr31-ver, .tr31-use, .tr31-mode, .tr31-exp, .tr31-ctx { background: rgba(99, 91, 255, .16); }
.tr31-len, .tr31-alg, .tr31-kv, .tr31-nob { background: rgba(99, 91, 255, .30); }
.tr31-opt { background: rgba(245, 158, 11, .25); }
.tr31-enc { background: rgba(100, 116, 139, .26); }
.tr31-mac { background: rgba(16, 185, 129, .25); }

.tr31-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-top: 8px;
    font-size: 12px;
}

.tr31-key {
    padding: 1px 8px;
    border-radius: 4px;
}

/* ── TR-34 tools ───────────────────────────────────────────────────────── */

.tr34-page {
    --tr34-pass: var(--colorPaletteGreenForeground1, #107c10);
    --tr34-pass-bg: var(--colorPaletteGreenBackground1, #f1faf1);
    --tr34-fail: var(--colorPaletteRedForeground1, #bc2f32);
    --tr34-fail-bg: var(--colorPaletteRedBackground1, #fdf3f4);
    --tr34-warn: var(--colorPaletteDarkOrangeForeground1, #c43501);
    --tr34-warn-bg: var(--colorPaletteYellowBackground1, #fffef5);
    --tr34-open: var(--app-text-3);
    --tr34-info: var(--colorPaletteBlueForeground2, #115ea3);
}

/* Header: the five pages, the PKI in use, the simulated KRD */
.tr34-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 16px;
}

.tr34-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tr34-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text-2);
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
}

    .tr34-step:hover {
        border-color: var(--app-brand);
        color: var(--app-brand-strong);
    }

    .tr34-step.active {
        border-color: var(--app-brand);
        background: var(--app-brand-soft);
        color: var(--app-brand-strong);
    }

.tr34-status {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tr34-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface-2);
    color: var(--app-text-2);
    font-size: 12px;
    text-decoration: none;
}

    .tr34-chip.is-bound {
        border-color: var(--tr34-pass);
        color: var(--tr34-pass);
    }

.tr34-kinds .segmented-item {
    padding: 0 11px;
}

.tr34-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid var(--app-border);
    border-radius: 5px;
    color: var(--app-text-3);
    font-size: 11px;
    font-weight: 600;
    line-height: 17px;
    vertical-align: 1px;
}

    .tr34-tag.is-fail { border-color: var(--tr34-fail); color: var(--tr34-fail); }
    .tr34-tag.is-warn { border-color: var(--tr34-warn); color: var(--tr34-warn); }
    .tr34-tag.is-pass { border-color: var(--tr34-pass); color: var(--tr34-pass); }

.tr34-outcome {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    white-space: nowrap;
}

    .tr34-outcome.is-pass, .tr34-count.is-pass { color: var(--tr34-pass); }
    .tr34-outcome.is-fail, .tr34-count.is-fail { color: var(--tr34-fail); }
    .tr34-outcome.is-warn, .tr34-count.is-warn { color: var(--tr34-warn); }
    .tr34-outcome.is-open, .tr34-count.is-open { color: var(--tr34-open); }
    .tr34-outcome.is-info, .tr34-count.is-info { color: var(--tr34-info); }

    .tr34-outcome svg, .tr34-count svg {
        fill: currentColor;
    }

.tr34-clause {
    margin-top: 2px;
    color: var(--app-text-3);
    font-size: 12px;
}

.tr34-detail {
    font-size: 13px;
    overflow-wrap: anywhere;
}

.tr34-subhead {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 650;
    color: var(--app-text-2);
}

.tr34-link {
    color: var(--app-brand-hover);
    font-size: 13px;
}

/* Check table */
.tr34-checks-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 10px;
}

.tr34-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
}

.tr34-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.tr34-check-table tr.is-fail td:first-child { box-shadow: inset 3px 0 0 var(--tr34-fail); }
.tr34-check-table tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--tr34-warn); }
.tr34-check-table tr.is-open td:first-child { box-shadow: inset 3px 0 0 var(--tr34-open); }
.tr34-check-table tr.is-fail { background: var(--tr34-fail-bg); }

/* Verdict bar */
.tr34-verdict {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface-2);
}

    .tr34-verdict.is-pass { border-color: var(--tr34-pass); background: var(--tr34-pass-bg); }
    .tr34-verdict.is-fail { border-color: var(--tr34-fail); background: var(--tr34-fail-bg); }
    .tr34-verdict.is-warn { border-color: var(--tr34-warn); background: var(--tr34-warn-bg); }

    .tr34-verdict.is-pass .tr34-verdict-icon { color: var(--tr34-pass); fill: var(--tr34-pass); }
    .tr34-verdict.is-fail .tr34-verdict-icon { color: var(--tr34-fail); fill: var(--tr34-fail); }
    .tr34-verdict.is-warn .tr34-verdict-icon { color: var(--tr34-warn); fill: var(--tr34-warn); }

.tr34-verdict-title {
    font-weight: 650;
}

.tr34-verdict-sub {
    margin-top: 2px;
    color: var(--app-text-2);
    font-size: 12.5px;
}

/* ASN.1 tree */
.asn1-tree {
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-2);
    font-family: var(--fontFamilyMonospace);
    font-size: 12.5px;
    line-height: 1.7;
    overflow-x: auto;
}

.asn1-node > summary {
    cursor: pointer;
    list-style-position: outside;
    margin-left: 14px;
}

.asn1-leaf {
    margin-left: 14px;
}

.asn1-children {
    margin-left: 6px;
    padding-left: 12px;
    border-left: 1px dashed var(--app-border-strong);
}

.asn1-head {
    display: inline;
}

.asn1-label {
    margin-right: 6px;
    color: var(--app-brand-strong);
    font-weight: 650;
}

.asn1-type {
    color: var(--app-text-2);
}

.asn1-len {
    margin-left: 4px;
    color: var(--app-text-3);
    font-size: 11px;
}

    .asn1-len::before { content: "("; }
    .asn1-len::after { content: ")"; }

.asn1-value {
    margin-left: 6px;
    color: var(--app-text);
    overflow-wrap: anywhere;
}

.asn1-note {
    margin-left: 8px;
    color: var(--app-text-3);
    font-family: var(--fontFamilyBase);
    font-style: italic;
}

/* Sequence diagram */
.tr34-seq {
    --tr34-result: 11em;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tr34-seq-lanes,
.tr34-msg {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) var(--tr34-result);
    align-items: center;
}

.tr34-lane-head {
    padding: 6px;
    border-bottom: 2px solid var(--app-border-strong);
    color: var(--app-text-2);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
}

.tr34-seq-empty {
    padding: 24px;
    color: var(--app-text-3);
    text-align: center;
}

.tr34-msg {
    position: relative;
    min-height: 54px;
    padding: 4px 0;
    border: 1px solid transparent;
    border-radius: var(--app-radius-sm);
    background-color: transparent;
    /* the three lifelines */
    background-image:
        linear-gradient(var(--app-border-strong), var(--app-border-strong)),
        linear-gradient(var(--app-border-strong), var(--app-border-strong)),
        linear-gradient(var(--app-border-strong), var(--app-border-strong));
    background-repeat: no-repeat;
    background-size: 1px 100%;
    background-position:
        calc((100% - var(--tr34-result)) / 6) 0,
        calc((100% - var(--tr34-result)) / 2) 0,
        calc((100% - var(--tr34-result)) * 5 / 6) 0;
    color: var(--app-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

    .tr34-msg:hover { border-color: var(--app-border); }
    .tr34-msg.selected { border-color: var(--app-brand-soft-border); background-color: var(--app-brand-soft); }
    .tr34-msg.is-setup { opacity: .72; }

.tr34-msg-arrow {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 calc(100% / (2 * var(--span, 2)));
    grid-row: 1;
}

.tr34-msg-label {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.tr34-msg-no {
    display: inline-block;
    min-width: 20px;
    margin-right: 6px;
    border-radius: 10px;
    background: var(--app-brand);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
}

.tr34-msg-dir {
    display: none;
    color: var(--app-text-3);
    font-weight: 500;
}

.tr34-msg-line {
    position: relative;
    height: 2px;
    background: var(--app-text-2);
}

    .tr34-msg-line::after {
        content: "";
        position: absolute;
        top: -5px;
        border: 6px solid transparent;
    }

    .tr34-msg-line.to-right::after { right: -2px; border-right: 0; border-left: 9px solid var(--app-text-2); }
    .tr34-msg-line.to-left::after { left: -2px; border-left: 0; border-right: 9px solid var(--app-text-2); }

.tr34-msg.is-fail .tr34-msg-line { background: repeating-linear-gradient(90deg, var(--tr34-fail) 0 6px, transparent 6px 10px); }
.tr34-msg.is-fail .tr34-msg-line.to-right::after { border-left-color: var(--tr34-fail); }
.tr34-msg.is-fail .tr34-msg-line.to-left::after { border-right-color: var(--tr34-fail); }

.tr34-msg-result {
    display: inline-flex;
    grid-column: 4;
    grid-row: 1;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    font-size: 12.5px;
    font-weight: 600;
}

.tr34-msg.is-pass .tr34-msg-result { color: var(--tr34-pass); fill: var(--tr34-pass); }
.tr34-msg.is-fail .tr34-msg-result { color: var(--tr34-fail); fill: var(--tr34-fail); }
.tr34-msg.is-open .tr34-msg-result { color: var(--tr34-open); }

/* Stack the messages when the card (not the window) is narrow. */
@container (max-width: 640px) {
    .tr34-seq-lanes { display: none; }

    .tr34-msg {
        grid-template-columns: minmax(0, 1fr);
        background-image: none;
        border-color: var(--app-border);
    }

    .tr34-msg-arrow {
        grid-column: 1 !important;
        padding: 0 10px;
    }

    .tr34-msg-label { text-align: left; }
    .tr34-msg-dir { display: inline; }
    .tr34-msg-line { display: none; }

    .tr34-msg-result {
        grid-column: 1;
        grid-row: 2;
        padding-top: 4px;
    }
}

/* Tables with selectable rows */
.tr34-row {
    cursor: pointer;
}

    .tr34-row:hover td { background: var(--app-surface-2); }
    .tr34-row.selected td { background: var(--app-brand-soft); }

.tr34-detail-row > td {
    padding: 12px !important;
    background: var(--app-surface-2);
}

/* Builder */
.tr34-deviations {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 6px 16px;
}

.tr34-token-output-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

/* KRD test kit */
.tr34-kit-row {
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-left-width: 3px;
    border-radius: var(--app-radius-sm);
    background: var(--app-surface);
}

    .tr34-kit-row + .tr34-kit-row { margin-top: 10px; }
    .tr34-kit-row.is-pass { border-left-color: var(--tr34-pass); }
    .tr34-kit-row.is-fail { border-left-color: var(--tr34-fail); }

.tr34-kit-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}

/* Print the conformance report only */
@media print {
    .app-header-item,
    .app-sidebar-item,
    .app-footer,
    .tr34-header,
    .tr34-noprint {
        display: none !important;
    }

    .tr34-page > :not(.tr34-printable) {
        display: none !important;
    }

    body, .app-content, .app-page {
        background: #fff !important;
    }

    .tr34-printable {
        box-shadow: none !important;
        border: 0 !important;
    }
}

.tr34-page .cols > .tr34-span-all {
    grid-column: 1 / -1;
}

.tr34-tall::part(control) {
    height: 14em;
    resize: vertical;
}

/* ── EMV Certification ─────────────────────────────────────────────────── */

.ec-page {
    --ec-pass: var(--colorPaletteGreenForeground1, #107c10);
    --ec-pass-bg: var(--colorPaletteGreenBackground1, #f1faf1);
    --ec-fail: var(--colorPaletteRedForeground1, #bc2f32);
    --ec-fail-bg: var(--colorPaletteRedBackground1, #fdf3f4);
    --ec-warn: var(--colorPaletteDarkOrangeForeground1, #c43501);
    --ec-warn-bg: var(--colorPaletteYellowBackground1, #fffef5);
    --ec-info: var(--colorPaletteBlueForeground2, #115ea3);
    --ec-muted: var(--app-text-3);
}

/* Header: the group's pages and the profiles in use */
.ec-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 16px;
}

.ec-steps, .ec-status, .ec-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ec-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text-2);
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
}

    .ec-step:hover { border-color: var(--app-brand); color: var(--app-brand-strong); }
    .ec-step.active { border-color: var(--app-brand); background: var(--app-brand-soft); color: var(--app-brand-strong); }

.ec-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface-2);
    color: var(--app-text-2);
    font-size: 12px;
    text-decoration: none;
    max-width: 100%;
    overflow-wrap: anywhere;
}

    .ec-chip.is-fail { border-color: var(--ec-fail); color: var(--ec-fail); }

.ec-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid var(--app-border);
    border-radius: 5px;
    color: var(--app-text-3);
    font-size: 11px;
    font-weight: 600;
    line-height: 17px;
    white-space: nowrap;
}

    .ec-tag.is-fail { border-color: var(--ec-fail); color: var(--ec-fail); }

.ec-subhead {
    margin: 16px 0 6px;
    font-size: 13px;
    font-weight: 650;
    color: var(--app-text-2);
}

.ec-ref {
    color: var(--ec-muted);
    font-size: 12px;
    white-space: nowrap;
}

.ec-faults {
    margin: 10px 0 4px;
    font-size: 13px;
}

    .ec-faults > summary { cursor: pointer; color: var(--app-text-2); font-weight: 600; }

.ec-fault-group fluent-checkbox, .ec-fault-group .fluent-checkbox { display: block; margin: 2px 0; }

/* Simulator: steps on the left, the selected step on the right */
.ec-sim-grid, .ec-flow-grid {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

.ec-flow-grid { grid-template-columns: minmax(280px, 460px) minmax(0, 1fr); }

.ec-flow-side { position: sticky; top: 72px; }

.ec-sim-steps, .ec-sim-detail, .ec-flow-side {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 12px;
    min-width: 0;
}

.ec-step-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ec-step-item > button {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

    .ec-step-item > button:hover { background: var(--app-surface-2); }
    .ec-step-item.selected > button { border-color: var(--app-brand); background: var(--app-brand-soft); }
    .ec-step-item.hidden-step { opacity: .45; padding: 7px 8px; display: flex; gap: 8px; }

.ec-step-no {
    flex: 0 0 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-surface-2);
    font-size: 12px;
    font-weight: 700;
}

.ec-step-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ec-step-name { font-size: 13px; font-weight: 600; }
.ec-step-summary { font-size: 12px; color: var(--app-text-3); overflow-wrap: anywhere; }
.ec-step-status { font-weight: 700; font-size: 13px; }

.ec-step-item.is-done .ec-step-status { color: var(--ec-pass); }
.ec-step-item.is-failed .ec-step-status { color: var(--ec-warn); }
.ec-step-item.is-stopped .ec-step-status { color: var(--ec-fail); }
.ec-step-item.is-skipped .ec-step-status { color: var(--ec-muted); }
.ec-step-item.is-stopped .ec-step-no { background: var(--ec-fail-bg); color: var(--ec-fail); }
.ec-step-item.is-failed .ec-step-no { background: var(--ec-warn-bg); color: var(--ec-warn); }

/* Step detail */
.ec-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

    .ec-detail-head h3 { margin: 0; font-size: 16px; }

.ec-decision {
    margin: 8px 0;
    padding: 8px 10px;
    border-left: 3px solid var(--ec-pass);
    background: var(--ec-pass-bg);
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

    .ec-decision.is-failed { border-color: var(--ec-warn); background: var(--ec-warn-bg); }
    .ec-decision.is-stopped { border-color: var(--ec-fail); background: var(--ec-fail-bg); }
    .ec-decision.is-skipped { border-color: var(--app-border); background: var(--app-surface-2); }

.ec-lines {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    font-size: 13px;
}

    .ec-lines li {
        display: flex;
        flex-wrap: wrap;
        gap: 2px 8px;
        padding: 3px 0;
        border-bottom: 1px dashed var(--app-border);
    }

        .ec-lines li:last-child { border-bottom: none; }

.ec-line-kind {
    flex: 0 0 74px;
    color: var(--ec-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding-top: 2px;
}

.ec-line-text { flex: 1 1 300px; min-width: 0; overflow-wrap: anywhere; }
.ec-lines .kind-decision .ec-line-text { font-weight: 600; }
.ec-lines .kind-warning .ec-line-text, .ec-lines .kind-warning .ec-line-kind { color: var(--ec-warn); }
.ec-lines .kind-error .ec-line-text, .ec-lines .kind-error .ec-line-kind { color: var(--ec-fail); }
.ec-lines .kind-card .ec-line-kind { color: var(--ec-info); }
.ec-lines .kind-host .ec-line-kind { color: var(--accent, var(--ec-info)); }

.ec-bit-cols { margin-top: 8px; }

.ec-bits {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    min-width: 0;
}

.ec-bits-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.ec-bits-title { font-weight: 650; }
.ec-bits-head code.changed { color: var(--ec-warn); font-weight: 700; }

.ec-bit-rows { list-style: none; margin: 0; padding: 0; }
    .ec-bit-rows li { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 2px 0; }
    .ec-bit-rows li.set-now { color: var(--ec-warn); font-weight: 600; }
    .ec-bit-rows li.cleared-now { color: var(--ec-muted); text-decoration: line-through; }

.ec-bit-pos { font-family: var(--fontFamilyMonospace, monospace); color: var(--ec-muted); flex: 0 0 44px; }
.ec-bit-change { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }

/* APDUs and messages */
.ec-apdus { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.ec-apdu {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    min-width: 0;
}

    .ec-apdu.not-ok { border-color: var(--ec-warn); }

.ec-apdu-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ec-apdu-no { color: var(--ec-muted); font-size: 12px; }
.ec-apdu-name { font-weight: 650; }
.ec-apdu-sw { font-family: var(--fontFamilyMonospace, monospace); font-weight: 700; }
.ec-apdu.not-ok .ec-apdu-sw { color: var(--ec-warn); }
.ec-apdu-status { color: var(--ec-muted); font-size: 12px; }

.ec-apdu-line { display: flex; gap: 8px; margin-top: 3px; }
    .ec-apdu-line .dir { flex: 0 0 14px; color: var(--ec-muted); font-weight: 700; font-size: 12px; }
    .ec-apdu-line code { overflow-wrap: anywhere; word-break: break-all; font-size: 12px; }

.ec-card-note { margin-top: 3px; color: var(--ec-info); font-size: 12px; }
.ec-apdu-tlv { margin-top: 6px; overflow-x: auto; }

.ec-message {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    min-width: 0;
}

    .ec-message.incoming { border-left: 3px solid var(--ec-pass); }
    .ec-message.outgoing { border-left: 3px solid var(--ec-info); }

.ec-message-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.ec-message-dir { color: var(--ec-muted); font-size: 12px; }

.ec-fields { width: 100%; border-collapse: collapse; font-size: 13px; }
    .ec-fields th { text-align: left; font-size: 12px; color: var(--ec-muted); font-weight: 650; padding: 4px 6px; border-bottom: 1px solid var(--app-border); }
    .ec-fields td { padding: 4px 6px; border-bottom: 1px solid var(--app-border); vertical-align: top; overflow-wrap: anywhere; }
    .ec-fields td.num { white-space: nowrap; color: var(--ec-muted); width: 1%; }
    .ec-fields td.name { color: var(--app-text-2); }
    .ec-fields td.value code { word-break: break-all; }
    .ec-fields tr.is-expired td { color: var(--ec-fail); }
.ec-kv td.name { width: 34%; }

.ec-data { margin-top: 12px; font-size: 13px; }
    .ec-data > summary { cursor: pointer; color: var(--app-text-2); font-weight: 600; }

.ec-hex { white-space: pre-wrap; word-break: break-all; font-size: 12px; max-height: 28em; overflow: auto; }
.ec-wrap { word-break: break-all; }
.ec-bitnames { font-size: 13px; color: var(--app-text-2); }
.ec-dol { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.ec-dol-entry { white-space: nowrap; }

/* Outcome */
.ec-outcome {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-left: 4px solid var(--ec-muted);
    border-radius: 12px;
    background: var(--app-surface);
}

    .ec-outcome.is-approved { border-left-color: var(--ec-pass); }
    .ec-outcome.is-declined { border-left-color: var(--ec-fail); }
    .ec-outcome.is-ended { border-left-color: var(--ec-warn); }

.ec-outcome-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }

.ec-outcome-badge {
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    background: var(--app-surface-2);
}

.ec-outcome.is-approved .ec-outcome-badge { background: var(--ec-pass-bg); color: var(--ec-pass); }
.ec-outcome.is-declined .ec-outcome-badge { background: var(--ec-fail-bg); color: var(--ec-fail); }
.ec-outcome.is-ended .ec-outcome-badge { background: var(--ec-warn-bg); color: var(--ec-warn); }
.ec-outcome-text { font-size: 13px; }

.ec-outcome-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 12px; color: var(--app-text-2); }
.ec-flag { color: var(--ec-warn); font-weight: 700; }
.ec-receipt-box { margin-top: 8px; font-size: 13px; }
    .ec-receipt-box > summary { cursor: pointer; font-weight: 600; color: var(--app-text-2); }
.ec-receipt {
    display: inline-block;
    margin: 6px 0 0;
    padding: 10px 14px;
    border: 1px dashed var(--app-border);
    border-radius: 6px;
    background: var(--app-surface-2);
    font-size: 12px;
    max-width: 100%;
    overflow-x: auto;
}

/* Step mode */
.ec-stepbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 16px;
    font-size: 13px;
}

.ec-pause {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--app-brand);
    border-radius: 10px;
    background: var(--app-brand-soft);
    font-size: 13px;
}

.ec-pause-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }

/* Flow explorer */
.ec-flow-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; font-size: 12px; }

.ec-legend {
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--app-border);
}

    .ec-legend.is-done { border-color: var(--ec-pass); color: var(--ec-pass); }
    .ec-legend.is-failed { border-color: var(--ec-warn); color: var(--ec-warn); }
    .ec-legend.is-stopped { border-color: var(--ec-fail); color: var(--ec-fail); }
    .ec-legend.is-skipped { border-style: dashed; color: var(--ec-muted); }
    .ec-legend.is-unreached { opacity: .5; }

.ec-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.ec-flow-node { position: relative; padding-bottom: 18px; }
    .ec-flow-node:not(:last-child)::after {
        content: "";
        position: absolute;
        left: 23px;
        bottom: 2px;
        height: 14px;
        border-left: 2px solid var(--app-border);
    }
    .ec-flow-node.is-done:not(:last-child)::after, .ec-flow-node.is-failed:not(:last-child)::after { border-left-color: var(--ec-pass); }

    .ec-flow-node > button {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
        padding: 8px 10px;
        border: 1px solid var(--app-border);
        border-radius: 10px;
        background: var(--app-surface);
        color: inherit;
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

        .ec-flow-node > button:disabled { cursor: default; }

    .ec-flow-node.is-done > button { border-color: var(--ec-pass); }
    .ec-flow-node.is-failed > button { border-color: var(--ec-warn); background: var(--ec-warn-bg); }
    .ec-flow-node.is-stopped > button { border-color: var(--ec-fail); background: var(--ec-fail-bg); }
    .ec-flow-node.is-skipped > button { border-style: dashed; color: var(--ec-muted); }
    .ec-flow-node.is-unreached > button { opacity: .45; }
    .ec-flow-node.focus > button { box-shadow: 0 0 0 2px var(--app-brand); }

.ec-flow-no {
    flex: 0 0 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-surface-2);
    font-weight: 700;
    font-size: 13px;
}

.ec-flow-node.is-done .ec-flow-no { background: var(--ec-pass-bg); color: var(--ec-pass); }
.ec-flow-node.is-stopped .ec-flow-no { background: var(--ec-fail); color: #fff; }
.ec-flow-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ec-flow-name { font-weight: 650; font-size: 14px; }
.ec-flow-what { font-size: 12px; color: var(--ec-muted); }
.ec-flow-summary { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }

.ec-branches { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0 48px; }

.ec-branch {
    padding: 1px 8px;
    border: 1px dashed var(--app-border);
    border-radius: 999px;
    font-size: 11px;
    color: var(--ec-muted);
}

    .ec-branch.taken { border-style: solid; border-color: var(--app-brand); background: var(--app-brand-soft); color: var(--app-brand-strong); font-weight: 650; }

/* Profile pages: list on the left, details on the right */
.ec-split {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ec-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: var(--app-surface);
    min-width: 0;
}

.ec-list-group { margin: 8px 6px 2px; font-size: 11px; font-weight: 700; color: var(--ec-muted); text-transform: uppercase; letter-spacing: .04em; }

.ec-list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

    .ec-list-item:hover { background: var(--app-surface-2); }
    .ec-list-item.active { border-color: var(--app-brand); background: var(--app-brand-soft); color: var(--app-brand-strong); }

.ec-list-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--app-border); }
.ec-main { min-width: 0; }
.ec-json { font-size: 12px; }

.ec-checks { list-style: none; margin: 0; padding: 0; font-size: 13px; }
    .ec-checks li { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 5px 0; border-bottom: 1px solid var(--app-border); }
    .ec-checks li.is-pass .ec-check-mark { color: var(--ec-pass); }
    .ec-checks li.is-fail .ec-check-mark, .ec-checks li.is-fail .ec-check-name { color: var(--ec-fail); }
.ec-check-mark { flex: 0 0 16px; font-weight: 700; }
.ec-check-name { flex: 0 0 240px; font-weight: 600; }
.ec-check-detail { flex: 1 1 260px; min-width: 0; color: var(--app-text-2); overflow-wrap: anywhere; }

@media (max-width: 900px) {
    .ec-sim-grid, .ec-flow-grid, .ec-split { grid-template-columns: minmax(0, 1fr); }
    .ec-flow-side { position: static; }
    .ec-check-name { flex-basis: 100%; }
    .ec-line-kind { flex-basis: 100%; }
}

/* EMV Certification: test cases, report, trace analyzer */
.ec-tests-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 20px; }
.ec-tests-bar .ec-search { flex: 1 1 240px; margin: 0; }
.ec-tests-counts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 4px; font-size: 13px; }

.ec-count { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ec-muted); }
    .ec-count.is-pass { color: var(--ec-pass); }
    .ec-count.is-fail { color: var(--ec-fail); }
    .ec-count.is-warn { color: var(--ec-warn); }
    .ec-count.is-info { color: var(--ec-info); }

.ec-progress {
    position: relative;
    height: 22px;
    margin-top: 10px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface-2);
    overflow: hidden;
    font-size: 12px;
}

    .ec-progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.ec-progress-bar { height: 100%; background: var(--app-brand-soft); border-right: 2px solid var(--app-brand); transition: width .15s; }

.ec-area { margin: 2px 0; }
    .ec-area > summary {
        display: flex;
        justify-content: space-between;
        gap: 6px;
        padding: 5px 8px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 600;
        color: var(--app-text-2);
    }
        .ec-area > summary:hover { background: var(--app-surface-2); }
.ec-area-count { color: var(--ec-muted); font-weight: 500; font-size: 12px; }
.ec-case { align-items: flex-start; flex-wrap: nowrap; padding-left: 14px; }
    .ec-case code { font-size: 11px; flex: 0 0 auto; }
.ec-case-title { font-size: 12px; color: var(--app-text-2); min-width: 0; overflow-wrap: anywhere; }

.ec-dot { flex: 0 0 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--app-border); }
    .ec-dot.v-pass { background: var(--ec-pass); }
    .ec-dot.v-fail { background: var(--ec-fail); }
    .ec-dot.v-notapplicable { background: var(--ec-info); }

.ec-verdict { margin: 12px 0 6px; font-weight: 800; font-size: 15px; letter-spacing: .04em; }
    .ec-verdict.is-pass { color: var(--ec-pass); }
    .ec-verdict.is-fail { color: var(--ec-fail); }

.ec-assertions tr.is-fail td { color: var(--ec-fail); }
.ec-assertions tr.is-pass td.num { color: var(--ec-pass); }

.ec-expect { margin: 0; padding-left: 18px; font-size: 13px; }
    .ec-expect li { margin: 2px 0; overflow-wrap: anywhere; }

.ec-findings-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; }
.ec-findings tr.lvl-pass td.num:first-child { color: var(--ec-pass); font-weight: 700; }
.ec-findings tr.lvl-fail td { background: var(--ec-fail-bg); }
.ec-findings tr.lvl-fail td.num:first-child { color: var(--ec-fail); font-weight: 700; }
.ec-findings tr.lvl-warning td.num:first-child { color: var(--ec-warn); font-weight: 700; }
.ec-findings tr.lvl-info td.num:first-child { color: var(--ec-info); font-weight: 700; }
.ec-trace { font-size: 12px; }

.ec-report-title { font-size: 17px; margin: 4px 0 10px; }
.ec-report .ec-total td { font-weight: 700; }
.ec-report-rows td { font-size: 12px; }
.ec-report-rows tr.verdict-fail td { color: var(--ec-fail); }
.ec-report-rows tr.verdict-pass td:nth-child(5) { color: var(--ec-pass); font-weight: 600; }
.ec-disclaimer { margin-top: 12px; font-size: 12px; color: var(--ec-muted); font-style: italic; }

@media print {
    .ec-header, .ec-noprint { display: none !important; }
    .ec-page > :not(.ec-printable) { display: none !important; }
    .ec-printable { box-shadow: none !important; border: 0 !important; }
    .ec-report-rows td, .ec-report td { color: #000 !important; }
}

/* Fluent v5 text areas: the class lands on the fluent-field wrapper; the height comes from --block-size on the fluent-textarea. */
.ec-tall fluent-textarea { --block-size: 16em; --min-block-size: 16em; --resize: vertical; }
.ec-short fluent-textarea { --block-size: 5em; --min-block-size: 5em; --resize: vertical; }
.ec-json fluent-textarea { --block-size: 30em; --min-block-size: 30em; --resize: vertical; }

/* EMV Certification: library, overview, roadmap, self-assessment */
.ec-doc-no { flex: 0 0 auto; min-width: 2.2em; color: var(--ec-muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.ec-docs .ec-list-item { flex-wrap: nowrap; text-decoration: none; color: inherit; }
.ec-doc-hit { flex-direction: column; align-items: flex-start !important; }

.ec-article {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 20px 24px 24px;
    min-width: 0;
    line-height: 1.6;
    font-size: 14.5px;
}

    .ec-article h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 6px; }
.ec-article-head { display: flex; gap: 6px; flex-wrap: wrap; }
.ec-article-summary { color: var(--app-text-2); font-size: 15px; margin: 0 0 12px; }
.ec-article-body h2 { font-size: 18px; margin: 26px 0 8px; padding-top: 4px; border-top: 1px solid var(--app-border); scroll-margin-top: 72px; }
.ec-article-body h3 { font-size: 15.5px; margin: 18px 0 6px; scroll-margin-top: 72px; }
.ec-article-body p, .ec-article-body ul, .ec-article-body ol { margin: 8px 0; }
.ec-article-body li { margin: 3px 0; }
.ec-article-body code { font-family: var(--fontFamilyMonospace, monospace); font-size: .92em; background: var(--app-surface-2); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }
.ec-article-body pre { background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.45; }
    .ec-article-body pre code { background: none; padding: 0; }
.ec-article-body blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--ec-warn); background: var(--ec-warn-bg); border-radius: 6px; }
    .ec-article-body blockquote p { margin: 4px 0; }
.ec-article-body table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 13.5px; display: block; overflow-x: auto; }
.ec-article-body th { text-align: left; font-weight: 650; padding: 6px 8px; border-bottom: 2px solid var(--app-border); white-space: nowrap; }
.ec-article-body td { padding: 6px 8px; border-bottom: 1px solid var(--app-border); vertical-align: top; }
.ec-article-body a { color: var(--app-brand-hover, var(--app-brand)); }
.ec-article-body input[type=checkbox] { margin-right: 6px; }

.ec-try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: 13px; color: var(--app-text-2); }
.ec-toc { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 12px; margin: 6px 0 4px; border: 1px dashed var(--app-border); border-radius: 8px; font-size: 13px; }
    .ec-toc a { color: var(--app-text-2); }
.ec-toc-title { flex-basis: 100%; font-weight: 650; font-size: 12px; color: var(--ec-muted); text-transform: uppercase; letter-spacing: .04em; }
.ec-prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--app-border); }
    .ec-prevnext a { display: flex; flex-direction: column; gap: 2px; max-width: 48%; text-decoration: none; color: inherit; padding: 8px 12px; border: 1px solid var(--app-border); border-radius: 10px; }
        .ec-prevnext a:hover { border-color: var(--app-brand); }
        .ec-prevnext a span { font-size: 12px; color: var(--ec-muted); }
        .ec-prevnext a.next { text-align: right; margin-left: auto; }

/* Inline SVG diagrams: colours follow the theme */
.ec-svg { display: block; width: 100%; max-width: 760px; height: auto; margin: 14px auto 18px; font-family: var(--fontFamilyBase, sans-serif); }
    .ec-svg .box rect, .ec-svg rect.box { fill: var(--app-surface-2); stroke: var(--app-border); stroke-width: 1.5; }
    .ec-svg .box.accent rect { fill: var(--app-brand-soft); stroke: var(--app-brand); }
    .ec-svg text { text-anchor: middle; fill: currentColor; }
    .ec-svg .t-strong text, .ec-svg text.t-strong { font-size: 13px; font-weight: 650; }
    .ec-svg .t-small text, .ec-svg text.t-small { font-size: 11px; fill: var(--app-text-2); }
    .ec-svg .line line, .ec-svg path.line { stroke: var(--app-text-3); stroke-width: 1.6; fill: none; }
    .ec-svg path.dashed { stroke-dasharray: 5 4; }
    .ec-svg .arrow { fill: var(--app-text-3); }

/* Cards (library home, overview tools) */
.ec-doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.ec-doc-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: var(--app-surface);
    color: inherit;
    text-decoration: none;
    font-size: 13px;
}
    .ec-doc-card:hover { border-color: var(--app-brand); }
    .ec-doc-card strong { font-size: 14px; }
    .ec-doc-card > span:last-child { color: var(--app-text-2); }
.ec-tools { margin-top: 16px; }
.ec-tool-icon { color: var(--accent, var(--app-brand)); }

.ec-lead { font-size: 15px; line-height: 1.6; margin-top: 0; }
.ec-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ec-level-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--app-border); border-radius: 12px; background: var(--app-surface-2); color: inherit; text-decoration: none; font-size: 13px; }
    .ec-level-card:hover { border-color: var(--app-brand); }
    .ec-level-card strong { font-size: 15px; }
.ec-level-no { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--app-brand-soft); color: var(--app-brand-strong); font-weight: 800; }
.ec-path { margin: 0; padding-left: 20px; line-height: 1.7; }

/* Roadmap */
.ec-plan-step { padding: 10px 12px; margin: 6px 0; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); }
.ec-plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ec-plan-box { font-size: 18px; line-height: 1; color: var(--ec-muted); }
.ec-plan-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Self-assessment */
.ec-quiz-question { font-size: 16px; font-weight: 600; line-height: 1.5; margin: 10px 0; }
.ec-quiz-options { display: flex; flex-direction: column; gap: 6px; }
.ec-quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: var(--app-surface);
    color: inherit;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
    .ec-quiz-option:hover:not(:disabled) { border-color: var(--app-brand); }
    .ec-quiz-option.chosen { border-color: var(--app-brand); background: var(--app-brand-soft); }
    .ec-quiz-option.is-right { border-color: var(--ec-pass); background: var(--ec-pass-bg); }
    .ec-quiz-option.is-wrong { border-color: var(--ec-fail); background: var(--ec-fail-bg); }
    .ec-quiz-option:disabled { cursor: default; }
.ec-quiz-mark { flex: 0 0 18px; }
.ec-quiz-review { padding: 8px 0; border-bottom: 1px solid var(--app-border); font-size: 13px; }

@media (max-width: 640px) {
    .ec-article { padding: 14px; }
    .ec-prevnext { flex-direction: column; }
        .ec-prevnext a { max-width: 100%; }
}

/* EMV Certification: contactless interface choice, L1 protocol lab */
.ec-interface {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 4px 0 12px;
}
    .ec-interface .input-group-label { margin: 0; }
    .ec-interface .hint { margin: 0; }

.ec-protocol td.ec-from { white-space: nowrap; font-weight: 650; font-size: 12px; }
.ec-protocol tr.from-terminal td.ec-from,
.ec-protocol tr.from-reader td.ec-from { color: var(--ec-info); }
.ec-protocol tr.from-card td.ec-from { color: var(--ec-pass); }
.ec-protocol td code { font-size: 12px; }

@media (max-width: 640px) {
    .ec-protocol th:nth-child(1), .ec-protocol td.num { display: none; }
}

/* ── Payment Training ──────────────────────────────────────────────────── */

.tr-page { --tr-accent: #c2410c; --tr-accent-bg: #fff1e6; }
body[data-theme="dark"] .tr-page { --tr-accent: #fb923c; --tr-accent-bg: rgba(251, 146, 60, .14); }

.tr-warning { display: flex; align-items: center; gap: 6px; margin: -6px 0 14px; font-size: 12px; }

/* Overview: stats, paths, curriculum map */
.tr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
    .tr-stats > div { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); }
    .tr-stats strong { font-size: 22px; color: var(--tr-accent); }
    .tr-stats span { font-size: 12px; color: var(--app-text-2); }

.tr-paths { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tr-path {
    display: flex; flex-direction: column; gap: 4px; padding: 12px; text-align: left; cursor: pointer;
    border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); color: inherit; font: inherit;
}
    .tr-path:hover { border-color: var(--tr-accent); }
    .tr-path.chosen { border-color: var(--tr-accent); background: var(--tr-accent-bg); }
    .tr-path > span { font-size: 13px; color: var(--app-text-2); }
    .tr-path .tr-path-count { font-size: 12px; }
.tr-bar { display: block; height: 4px; border-radius: 2px; background: var(--app-border); overflow: hidden; }
    .tr-bar > span { display: block; height: 100%; background: var(--tr-accent); }

.tr-sequence { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 6px 0 10px; list-style: none; counter-reset: tr-seq; }
    .tr-sequence li { counter-increment: tr-seq; }
    .tr-sequence a {
        display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--app-border); border-radius: 999px;
        font-size: 12px; color: var(--app-text-2); text-decoration: none; background: var(--app-surface);
    }
    .tr-sequence a::before { content: counter(tr-seq); font-weight: 700; color: var(--ec-muted); }
    .tr-sequence li.is-progress a { border-color: var(--tr-accent); }
    .tr-sequence li.is-mastered a { border-color: var(--ec-pass); background: var(--ec-pass-bg); color: var(--ec-pass); }

.tr-track { margin-bottom: 16px; }
.tr-track-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tr-track-id {
    display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px;
    background: var(--tr-accent-bg); color: var(--tr-accent); font-weight: 800;
}
.tr-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tr-module {
    display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--app-border); border-left: 3px solid var(--app-border);
    border-radius: 10px; background: var(--app-surface); color: inherit; text-decoration: none;
}
    .tr-module:hover { border-color: var(--tr-accent); }
    .tr-module.is-progress { border-left-color: var(--tr-accent); }
    .tr-module.is-mastered { border-left-color: var(--ec-pass); }
    .tr-module strong { font-size: 14px; }
.tr-mod-id { font-size: 12px; font-weight: 800; color: var(--tr-accent); }
.tr-mod-summary { font-size: 12px; color: var(--app-text-2); line-height: 1.4; }
.tr-mod-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--ec-muted); margin-top: auto; }
    .tr-module.is-mastered .tr-state { color: var(--ec-pass); font-weight: 700; }
.tr-soon { font-style: italic; }

.tr-file { position: relative; display: inline-flex; align-items: center; padding: 5px 12px; border: 1px solid var(--app-border); border-radius: 6px; cursor: pointer; font-size: 14px; }
    .tr-file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Module page */
.tr-module-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
    .tr-module-head .tr-track-id { min-width: 44px; height: 44px; font-size: 16px; }
    .tr-module-head .page-title { margin: 2px 0; }
.tr-module-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.tr-module-side { position: sticky; top: 12px; padding: 12px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); font-size: 13px; }
.tr-outcomes, .tr-checklist { margin: 4px 0 10px; padding-left: 18px; }
    .tr-outcomes li, .tr-checklist li { margin: 3px 0; }
.tr-checklist { list-style: none; padding-left: 0; }
    .tr-checklist li::before { content: "○ "; color: var(--ec-muted); }
    .tr-checklist li.done::before { content: "✓ "; color: var(--ec-pass); font-weight: 700; }
.tr-prevnext { display: flex; flex-direction: column; gap: 6px; }
    .tr-prevnext a { font-size: 12px; }

.tr-type-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tr-type {
    padding: 5px 12px; border: 1px solid var(--app-border); border-radius: 999px; background: var(--app-surface); color: var(--app-text-2);
    font: inherit; font-size: 13px; cursor: pointer;
}
    .tr-type.active { border-color: var(--tr-accent); background: var(--tr-accent-bg); color: var(--app-text); }
    .tr-type.is-done span { color: var(--ec-pass); font-weight: 700; }
.tr-difficulty { margin-bottom: 10px; }

/* Exercise */
.tr-prompt { font-size: 15px; font-weight: 600; line-height: 1.5; margin: 10px 0; }
.tr-givens { margin-bottom: 12px; }
.tr-answer { margin-bottom: 12px; padding-left: 10px; border-left: 3px solid transparent; }
    .tr-answer.is-pass { border-left-color: var(--ec-pass); }
    .tr-answer.is-fail { border-left-color: var(--ec-fail); }
.tr-expected { margin-top: 4px; font-size: 13px; color: var(--ec-fail); }
.tr-tool-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; padding: 5px 8px; }
.tr-code { min-width: 220px; }

/* Worked example and solution steps */
.tr-example-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 14px; }
.tr-trail { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tr-step { padding: 10px 12px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); }
    .tr-step.is-answer { border-color: var(--ec-pass); box-shadow: inset 3px 0 0 var(--ec-pass); }
.tr-step-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 6px; }
.tr-step-no {
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--tr-accent-bg); color: var(--tr-accent); font-size: 12px; font-weight: 800;
}
.tr-op { font-size: 12px; color: var(--app-text-2); font-style: italic; }
.tr-io { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin: 0 0 6px; font-size: 13px; }
    .tr-io dt { color: var(--ec-muted); }
    .tr-io dd { margin: 0; }
.tr-out { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; }
.tr-out-label { font-weight: 700; }
.tr-out code { font-size: 13px; }
.tr-out mark { background: var(--tr-accent-bg); color: var(--tr-accent); border-radius: 2px; padding: 0 1px; }
.tr-why { margin: 6px 0 0; font-size: 12px; color: var(--app-text-2); }

@media (max-width: 900px) {
    .tr-module-grid { grid-template-columns: minmax(0, 1fr); }
    .tr-module-side { position: static; }
}

@media (max-width: 640px) {
    .tr-module-head { flex-direction: column; gap: 6px; }
    .tr-io { grid-template-columns: minmax(0, 1fr); }
}

/* Payment Training: transaction flows */
.tr-table-wrap { overflow-x: auto; }
.tr-types td { font-size: 13px; }
    .tr-types td .hint { font-size: 12px; margin-top: 2px; }
    .tr-types .ec-chip { margin: 0 4px 4px 0; cursor: pointer; }
.tr-ns { color: var(--ec-warn); }
.tr-teaches { margin: 8px 0; }
.tr-flow-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.tr-flow-side { min-height: 60px; }
.tr-moves { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.tr-seq-wrap { overflow-x: auto; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); }
.tr-seq { display: block; width: 100%; height: auto; font-family: var(--fontFamilyBase, sans-serif); }
    .tr-seq text { fill: currentColor; text-anchor: middle; }
    .tr-seq .lane-head { fill: var(--tr-accent-bg); stroke: var(--tr-accent); stroke-width: 1; }
    .tr-seq .lane-name { font-size: 13px; font-weight: 700; }
    .tr-seq .lifeline { stroke: var(--app-border); stroke-width: 1.5; stroke-dasharray: 4 4; }
    .tr-seq .stage-line { stroke: var(--app-border); stroke-width: 1; }
    .tr-seq .stage-name, .tr-seq .branch-mark { font-size: 11px; text-anchor: start; fill: var(--ec-muted); font-weight: 700; }
    .tr-seq .branch-mark { fill: var(--tr-accent); }
    .tr-seq .step { cursor: pointer; }
    .tr-seq .step .row { fill: transparent; }
    .tr-seq .step:hover .row { fill: var(--app-surface-2, rgba(127, 127, 127, .06)); }
    .tr-seq .step.selected .row { fill: var(--tr-accent-bg); }
    .tr-seq .step.branch .arrow-line { stroke: var(--tr-accent); }
    .tr-seq .arrow-line { stroke: var(--app-text-2); stroke-width: 1.6; }
    .tr-seq .arrow { fill: var(--app-text-2); }
    .tr-seq .action { fill: var(--app-surface-2, var(--app-surface)); stroke: var(--app-border); stroke-width: 1.2; }
    .tr-seq .step-label { font-size: 12px; }
    .tr-seq .step-no { font-size: 11px; fill: var(--ec-muted); }
    .tr-seq .money { fill: var(--ec-pass-bg); stroke: var(--ec-pass); stroke-width: 1; }
    .tr-seq .money-sign { font-size: 11px; font-weight: 800; fill: var(--ec-pass); }
.tr-money td { font-size: 13px; white-space: nowrap; }
    .tr-money tr { cursor: pointer; }
    .tr-money tr.selected td { background: var(--tr-accent-bg); }
    .tr-money tr.start td { color: var(--ec-muted); }
    .tr-money td.neg { color: var(--ec-fail); }
    .tr-money td.pos { color: var(--ec-pass); }

/* Payment Training: challenges, vectors, exams and record */
.tr-artefact { white-space: pre-wrap; word-break: break-word; font-size: 12.5px; padding: 10px 12px; border: 1px solid var(--app-border); border-left: 3px solid var(--tr-accent); border-radius: 8px; background: var(--app-surface); margin: 8px 0 12px; }
.tr-vector-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding-bottom: 12px; }
.tr-vectors td { font-size: 12.5px; }
    .tr-vectors td .hint { font-size: 11.5px; }
    .tr-vectors tr.is-pass td:last-child { color: var(--ec-pass); font-weight: 700; }
    .tr-vectors tr.is-fail td:last-child { color: var(--ec-fail); font-weight: 700; }
.tr-in-name { color: var(--ec-muted); font-size: 11.5px; }
.tr-record h2 { font-size: 18px; margin: 4px 0 10px; }
.tr-learn { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
@media print {
    .tr-warning { display: none !important; }
    .tr-record { color: #000; }
}

/* Payment Training: glossary */
.tr-letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 4px; }
    .tr-letters a { min-width: 28px; text-align: center; padding: 3px 6px; border: 1px solid var(--app-border); border-radius: 6px; text-decoration: none; font-weight: 600; }
    .tr-letters a:hover { border-color: var(--tr-accent); }
.tr-letter { font-size: 16px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--app-border); scroll-margin-top: 70px; }
.tr-glossary { margin: 0; }
    .tr-glossary dt { font-weight: 700; margin-top: 10px; }
    .tr-glossary dd { margin: 2px 0 0 0; line-height: 1.5; }
.tr-aka { font-weight: 400; color: var(--ec-muted); }
.tr-term-module { margin-left: 6px; font-size: 12.5px; white-space: nowrap; }
.tr-terms { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }

/* Payment Training: the journey lab */
.tr-adjust { margin: 0 0 8px; padding-left: 18px; }
.tr-receipt { display: inline-block; margin: 8px 0 0; padding: 10px 14px; border: 1px dashed var(--app-border); border-radius: 8px; background: var(--app-surface); font-size: 12.5px; white-space: pre-wrap; }
.tr-logs { white-space: pre-wrap; word-break: break-word; font-size: 12px; padding: 10px 12px; border: 1px solid var(--app-border); border-radius: 8px; background: var(--app-surface); max-height: 360px; overflow: auto; margin: 6px 0 12px; }
.tr-step-nav { display: flex; justify-content: space-between; margin: 10px 0 4px; }
.tr-jstep { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); }
.tr-jstep-title { font-size: 16px; margin: 8px 0 4px; }
.tr-status.is-failed { border-color: var(--ec-fail); color: var(--ec-fail); }
.tr-status.is-warning { border-color: #c47f00; color: #c47f00; }
.tr-status.is-done { border-color: var(--ec-pass); color: var(--ec-pass); }
.tr-fault-chip { border-color: var(--tr-accent); color: var(--tr-accent); background: var(--tr-accent-bg); cursor: pointer; font: inherit; }
.ec-verdict.tr-warn { border-color: #c47f00; color: #8a5a00; background: rgba(196, 127, 0, .08); }
.tr-hsm { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--app-border); border-left: 3px solid var(--tr-accent); border-radius: 8px; }
.tr-hsm-head { margin-bottom: 6px; font-size: 13px; }
.tr-hsm-io { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .tr-hsm-io code { display: block; font-size: 11.5px; padding: 6px 8px; background: var(--app-surface-2, rgba(127, 127, 127, .06)); border-radius: 6px; }
    .tr-hsm-io table { margin-top: 6px; font-size: 12px; }
    .tr-hsm-io th { white-space: normal; font-weight: 600; width: 40%; }
.tr-wire { margin: 10px 0; }
.tr-wire-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.tr-wire-fields td { font-size: 12.5px; vertical-align: top; }
.tr-bytes { margin: 6px 0; }
    .tr-bytes summary { cursor: pointer; font-size: 12.5px; color: var(--ec-muted); }
    .tr-bytes pre { font-size: 11.5px; margin: 6px 0 0; padding: 8px 10px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 6px; overflow-x: auto; }
.tr-jsteps { display: grid; gap: 4px; margin-bottom: 8px; }
.tr-jstep-row { display: grid; grid-template-columns: 34px minmax(80px, 160px) 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--app-border); border-left-width: 3px; border-radius: 8px; background: var(--app-surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
    .tr-jstep-row.active { border-color: var(--tr-accent); background: var(--tr-accent-bg); }
    .tr-jstep-row.is-failed { border-left-color: var(--ec-fail); }
    .tr-jstep-row.is-warning { border-left-color: #c47f00; }
    .tr-jstep-row.is-done { border-left-color: var(--ec-pass); }
.tr-jstep-no { font-weight: 700; color: var(--ec-muted); text-align: right; }
.tr-jstep-group { color: var(--ec-muted); font-size: 12px; }
.tr-jstep-status { font-size: 12px; color: var(--ec-muted); }
.tr-seq .step.failed .row { fill: var(--ec-fail-bg, rgba(200, 40, 40, .12)); }
.tr-seq .step.failed .arrow-line, .tr-seq .step.failed .action { stroke: var(--ec-fail); }
.tr-seq .step.warned .row { fill: rgba(196, 127, 0, .10); }
.tr-seq .fault-mark { font-size: 13px; }
.tr-options { display: grid; gap: 6px; margin: 6px 0 10px; }
.tr-option { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--app-border); border-radius: 8px; cursor: pointer; }
    .tr-option.is-right { border-color: var(--ec-pass); background: var(--ec-pass-bg); }
    .tr-option.is-wrong { border-color: var(--ec-fail); }
.tr-reveal { margin-top: 10px; }
@media (max-width: 720px) {
    .tr-hsm-io { grid-template-columns: 1fr; }
    .tr-jstep-row { grid-template-columns: 28px 1fr auto; }
        .tr-jstep-row .tr-jstep-group { display: none; }
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .ec-verdict.tr-warn { color: #f0b95a; }
}
:root[data-theme="dark"] .ec-verdict.tr-warn { color: #f0b95a; }

/* ── Access tiers and the supporter pass ─────────────────────────────── */
.nav-lock { display: inline-flex; margin-left: 6px; opacity: .6; vertical-align: middle; }
    .nav-lock svg { width: 13px; height: 13px; }
.nav-count { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--app-brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.tool-tile.is-locked .tool-tile-title { color: var(--app-text-2); }
.tool-tile-badge { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 1px 8px; border: 1px solid var(--app-brand-soft-border); border-radius: 999px; background: var(--app-brand-soft); color: var(--app-brand-strong); font-size: 11.5px; font-weight: 600; width: fit-content; }
    .tool-tile-badge svg { width: 12px; height: 12px; }
.support-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.locked-feature .locked-badge { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; padding: 3px 10px; border: 1px solid var(--app-brand-soft-border); border-radius: 999px; background: var(--app-brand-soft); color: var(--app-brand-strong); font-weight: 600; font-size: 13px; }

/* Public preview of a locked Payment Training / EMV Certification page (LockedPreview). */
.locked-preview { display: grid; gap: 16px; margin-top: 16px; }
.locked-preview p { margin: 0 0 10px; }
.locked-preview .lp-meta { color: var(--app-text-2); font-size: 13.5px; }
.locked-preview .lp-h { margin: 20px 0 8px; font-size: 15px; font-weight: 650; color: var(--app-text); }
.locked-preview .lp-h:first-child { margin-top: 0; }
.locked-preview .lp-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
    .locked-preview .lp-checks li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; }
    .locked-preview .lp-checks svg { margin-top: 3px; fill: var(--app-brand); }
.locked-preview .lp-sections { margin: 0; padding-left: 22px; columns: 2 260px; column-gap: 32px; }
    .locked-preview .lp-sections li { break-inside: avoid; margin-bottom: 4px; }
.locked-preview .lp-list { margin: 0; padding-left: 20px; }
    .locked-preview .lp-list li { margin-bottom: 4px; }
.locked-preview .lp-terms { margin: 0; }
    .locked-preview .lp-terms dt { margin-top: 10px; font-weight: 600; color: var(--app-text); }
    .locked-preview .lp-terms dd { margin: 2px 0 0; color: var(--app-text-2); }
.locked-preview .lp-tool { display: inline-block; margin: 4px 6px 0 0; padding: 2px 10px; border: 1px solid var(--app-border); border-radius: 999px; font-size: 13px; text-decoration: none; }
    .locked-preview .lp-tool:hover { border-color: var(--app-brand); }
.locked-preview .lp-links { list-style: none; margin: 0 0 4px; padding: 0; }
    .locked-preview .lp-links li { padding: 8px 0; border-bottom: 1px solid var(--app-border); }
    .locked-preview .lp-links li:last-child { border-bottom: 0; }
    .locked-preview .lp-links span { display: block; margin-top: 2px; color: var(--app-text-2); font-size: 13.5px; }
.locked-preview .lp-letter { color: var(--app-text-2); font-size: 14px; }
    .locked-preview .lp-letter strong { margin-right: 8px; color: var(--app-text); }
.locked-preview .lp-rest { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--app-brand-soft-border); border-radius: var(--app-radius); background: var(--app-brand-soft); color: var(--app-brand-strong); font-weight: 600; font-size: 14px; }
    .locked-preview .lp-rest svg { flex: none; fill: currentColor; }

.tier-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--app-border); border-radius: 999px; color: var(--app-text-2); font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
    .tier-chip:hover { border-color: var(--app-brand); color: var(--app-brand-strong); }
    .tier-chip.is-supporter { border-color: var(--app-brand-soft-border); background: var(--app-brand-soft); color: var(--app-brand-strong); }
@media (max-width: 720px) {
    .tier-chip span { display: none; }
}
@media (max-width: 520px) {
    .tier-chip { display: none; }
}

.support-banner { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--app-border); border-left-width: 4px; border-radius: var(--app-radius-sm); background: var(--app-surface); }
    .support-banner > span { flex: 1; }
    .support-banner.is-good { border-left-color: #16a34a; }
    .support-banner.is-bad { border-left-color: #dc2626; }
    .support-banner.is-warn { border-left-color: #d97706; }
.support-banner-close { border: 0; background: transparent; color: var(--app-text-3); cursor: pointer; font-size: 14px; }

.plans-intro h1, .account-page h1 { font-size: 26px; margin: 0 0 8px; }
.plans-intro p { max-width: 820px; color: var(--app-text-2); }
.plans-you { margin: 6px 0 16px; padding: 8px 12px; border-radius: var(--app-radius-sm); background: var(--app-brand-soft); display: inline-block; }
.plan-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0 18px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow-sm); }
    .plan-card.is-featured { border-color: var(--app-brand); box-shadow: var(--app-shadow-md); }
    .plan-card p { color: var(--app-text-2); flex: 1; margin: 6px 0; }
.plan-name { font-weight: 700; color: var(--app-brand-strong); text-transform: uppercase; letter-spacing: .04em; font-size: 12.5px; }
.plan-price { font-size: 26px; font-weight: 800; }
    .plan-price span { font-size: 14px; font-weight: 500; color: var(--app-text-2); }
.plan-sub, .plan-count { color: var(--app-text-2); font-size: 13px; }
.plan-count { font-weight: 600; }
.plan-table td, .plan-table th { font-size: 13px; }
.plan-table tr.plan-category th { background: var(--app-surface-2); text-align: left; }
.plan-mark { text-align: center; color: #16a34a; font-weight: 700; width: 110px; }
.plan-faq dt { font-weight: 700; margin-top: 10px; }
.plan-faq dd { margin: 2px 0 0; color: var(--app-text-2); }
@media (max-width: 860px) {
    .plan-cards { grid-template-columns: 1fr; }
    .plan-mark { width: auto; }
}

.pass-steps { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
    .pass-steps li { padding-left: 4px; }
.pass-pay { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.paypal-form { margin: 0; }
.paypal-btn { display: inline-flex; align-items: center; padding: 8px 16px; border: 0; border-radius: 999px; background: #ffc439; color: #111; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
    .paypal-btn:hover { background: #f2ba36; }
.pass-mail { margin-top: 8px; }
    .pass-mail summary { cursor: pointer; color: var(--app-text-2); font-size: 13px; }
.pass-mail-text { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); background: var(--app-surface-2); }
    .pass-mail-text pre { white-space: pre-wrap; margin: 6px 0; font-size: 12.5px; }

.account-tier { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.account-tier-name { font-size: 20px; font-weight: 800; color: var(--app-brand-strong); }

.admin-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 12px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.admin-stat { padding: 10px 12px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); background: var(--app-surface-2); color: var(--app-text-2); font-size: 12.5px; }
    .admin-stat span { display: block; font-size: 20px; font-weight: 800; color: var(--app-text); }
.admin-actions { white-space: nowrap; }
.admin-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 12px; }
    .admin-facts dt { color: var(--app-text-2); }
    .admin-facts dd { margin: 0; }
.status-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--app-surface-2); border: 1px solid var(--app-border); }
    .status-pill.is-pending { color: #b45309; border-color: #fcd34d; }
    .status-pill.is-granted { color: #15803d; border-color: #86efac; }
    .status-pill.is-declined { color: #b91c1c; border-color: #fca5a5; }
