/* TrustCheck member app (dashboard and sign-in pages), the TC UI / EasyUI visual language: shadcn "zinc" neutrals,
   Geist, 14px type, quiet borders, near-black primary buttons and TrustCheck amber as the brand accent.
   Same tokens as the admin (assets/admin/css/tc-admin.css), so TC UI components (tcui.css reads --background, --card,
   --muted, --border, --foreground...) follow both themes. Dark mode: html[data-theme="dark"] (partials/tc_theme_head).
   Vocabulary: app-* classes, documented in the section headers below. */

@font-face { font-family: "Geist"; src: url("../../../admin/fonts/geist-variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --subtle: #fafafa;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --input: #e4e4e7;
    --primary: #18181b;
    --primary-hover: #27272a;
    --primary-foreground: #fafafa;
    --accent: #f4f4f5;
    --ring: #a1a1aa;
    --ring-shadow: 0 0 0 3px rgba(161, 161, 170, 0.35);
    --brand: #f5a623;
    --brand-hover: #ffb93d;
    --brand-fg: #15140f;
    --brand-soft: #fef6e7;
    --brand-ink: #8a5a00;
    --brand-line: #f6dcaa;
    --ok: #16a34a;
    --ok-soft: #f0fdf4;
    --ok-ink: #15803d;
    --ok-line: #bbf7d0;
    --wait: #d97706;
    --wait-soft: #fffbeb;
    --wait-ink: #b45309;
    --wait-line: #fde68a;
    --bad: #dc2626;
    --bad-soft: #fef2f2;
    --bad-ink: #b91c1c;
    --bad-line: #fecaca;
    --info: #2563eb;
    --info-soft: #eff6ff;
    --info-ink: #1d4ed8;
    --info-line: #bfdbfe;
    --destructive: #dc2626;
    --sidebar: #fafafa;
    --sidebar-border: #e4e4e7;
    --sidebar-accent: #f4f4f5;
    --sidebar-fg: #3f3f46;
    --topbar-bg: rgba(255, 255, 255, 0.86);
    --row-hover: #fafafa;
    --chart-1: #f5a623;
    --chart-2: #2a9d90;
    --chart-3: #6d7cff;
    --chart-4: #e76e50;
    --chart-5: #a1a1aa;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.16), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --app-sidebar: 264px;
    --app-sidebar-rail: 60px;
    --app-topbar: 56px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --background: #09090b;
    --foreground: #fafafa;
    --card: #0f0f11;
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --subtle: #131316;
    --border: #27272a;
    --border-strong: #3f3f46;
    --input: #27272a;
    --primary: #fafafa;
    --primary-hover: #e4e4e7;
    --primary-foreground: #18181b;
    --accent: #1f1f23;
    --ring: #52525b;
    --ring-shadow: 0 0 0 3px rgba(82, 82, 91, 0.55);
    --brand-soft: rgba(245, 166, 35, 0.12);
    --brand-ink: #ffc870;
    --brand-line: rgba(245, 166, 35, 0.32);
    --ok: #22c55e;
    --ok-soft: rgba(34, 197, 94, 0.12);
    --ok-ink: #4ade80;
    --ok-line: rgba(34, 197, 94, 0.3);
    --wait: #f59e0b;
    --wait-soft: rgba(245, 158, 11, 0.12);
    --wait-ink: #fbbf24;
    --wait-line: rgba(245, 158, 11, 0.3);
    --bad: #ef4444;
    --bad-soft: rgba(239, 68, 68, 0.12);
    --bad-ink: #f87171;
    --bad-line: rgba(239, 68, 68, 0.32);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.12);
    --info-ink: #93c5fd;
    --info-line: rgba(96, 165, 250, 0.3);
    --destructive: #ef4444;
    --sidebar: #0c0c0e;
    --sidebar-border: #1f1f23;
    --sidebar-accent: #1f1f23;
    --sidebar-fg: #d4d4d8;
    --topbar-bg: rgba(9, 9, 11, 0.82);
    --row-hover: #131316;
    --chart-5: #52525b;
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
}

/* =========================================================================
   Base
   ========================================================================= */
body.app-body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--foreground);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "ss01" on;
}
.app-body *, .app-body *::before, .app-body *::after { box-sizing: border-box; }
.app-body ::selection { background: var(--brand); color: var(--brand-fg); }
.app-body :focus { outline: none; }
.app-body :focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; box-shadow: none; }
.app-body * { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
.app-body :where(h1, h2, h3, h4, h5, h6) { font-family: var(--font); color: var(--foreground); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; margin: 0; }
.app-body :where(p) { margin: 0; }
.app-body :where(a) { color: inherit; text-decoration: none; }
.app-body :where(a:not([class])) { color: var(--foreground); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.app-body :where(a:not([class]):hover) { text-decoration-color: currentColor; }
.app-body :where(img, svg) { max-width: 100%; }
.app-body :where(strong, b) { font-weight: 600; }
.app-body :where(small) { font-size: 12px; }
.app-body :where(code, kbd, pre) { font-family: var(--mono); }
.app-body :where(button, input, select, textarea) { font: inherit; color: inherit; }
.app-body :where(ul, ol) { margin: 0; padding: 0; }
.app-body :where(hr) { border: 0; border-top: 1px solid var(--border); margin: 16px 0; opacity: 1; }
.app-icon { display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.app-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tc-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-muted { color: var(--muted-foreground); }
.app-mono { font-family: var(--mono); font-size: 13px; }
.app-num { font-variant-numeric: tabular-nums; }
.app-nowrap { white-space: nowrap; }
.app-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* =========================================================================
   Shell: .app-sidebar, .app-main, .app-topbar, .app-content
   ========================================================================= */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--app-sidebar);
    background: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width 0.2s var(--ease), transform 0.25s var(--ease-out);
}
.app-sidebar__head { height: var(--app-topbar); display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; flex: 0 0 auto; }
.app-logo { display: flex; align-items: center; color: var(--foreground); min-width: 0; }
.app-logo .trustcheck-logo, .app-logo svg { height: 26px; width: auto; color: var(--foreground); display: block; }
.app-sidebar__close.app-icon-btn { margin-left: auto; display: none; }

/* Workspace card: the member's brand (or reviewer profile) under the logo */
.app-workspace { margin: 4px 8px 4px; padding: 8px; border-radius: var(--radius-md); display: flex; align-items: center; gap: 10px; color: var(--foreground); border: 1px solid var(--sidebar-border); background: var(--card); box-shadow: var(--shadow-xs); transition: background-color 0.15s var(--ease); }
.app-workspace:hover { background: var(--accent); }
.app-workspace__logo { width: 32px; height: 32px; border-radius: var(--radius-md); flex: 0 0 auto; overflow: hidden; display: grid; place-items: center; background: var(--brand); color: var(--brand-fg); font-weight: 700; font-size: 13px; }
.app-workspace__logo img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.app-workspace__text { display: grid; min-width: 0; line-height: 1.3; flex: 1 1 auto; }
.app-workspace__text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-workspace__text span { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-workspace > .app-icon { color: var(--muted-foreground); }

.app-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 4px 8px 12px; }
.app-nav__group + .app-nav__group { margin-top: 12px; }
.app-nav__label { display: flex; align-items: center; height: 28px; padding: 0 8px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; }
.app-nav__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-md);
    color: var(--sidebar-fg);
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.app-nav__link .app-icon { color: var(--muted-foreground); transition: color 0.15s var(--ease); }
.app-nav__link > span:not([class]) { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.app-nav__link:hover { background: var(--sidebar-accent); color: var(--foreground); }
.app-nav__link:hover .app-icon { color: var(--foreground); }
.app-nav__link.is-active { background: var(--sidebar-accent); color: var(--foreground); font-weight: 500; }
.app-nav__link.is-active .app-icon { color: var(--foreground); }
.app-nav__link.is-active::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.app-nav__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--brand-fg); font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.app-nav__plan { margin-left: auto; flex: 0 0 auto; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--brand-ink); background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 999px; padding: 0 6px; line-height: 18px; }
.app-nav details > summary { list-style: none; }
.app-nav details > summary::-webkit-details-marker { display: none; }
.app-nav details > summary .app-chev { margin-left: 4px; transition: transform 0.2s var(--ease); }
.app-nav details[open] > summary .app-chev { transform: rotate(180deg); }
.app-nav details .app-nav__sub { margin: 2px 0 4px 13px; padding-left: 3px; border-left: 1px solid var(--sidebar-border); display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.app-nav details .app-nav__sub .app-nav__link { height: 30px; font-size: 13px; }
.app-nav details .app-nav__sub .app-nav__link { gap: 8px; padding-right: 4px; }
.app-nav details .app-nav__sub .app-nav__plan { font-size: 9px; letter-spacing: 0.01em; padding: 0 4px; line-height: 16px; }

.app-upgrade { margin: 0 8px 8px; padding: 12px; border-radius: var(--radius-lg); border: 1px solid var(--brand-line); background: var(--brand-soft); display: grid; gap: 6px; }
.app-upgrade strong { font-size: 13px; }
.app-upgrade p { font-size: 12px; color: var(--muted-foreground); line-height: 1.45; }

.app-sidebar__foot { flex: 0 0 auto; padding: 8px; border-top: 1px solid var(--sidebar-border); }
.app-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-md); width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--foreground); }
.app-user:hover { background: var(--sidebar-accent); }
.app-user__text { display: grid; line-height: 1.3; min-width: 0; flex: 1 1 auto; }
.app-user__text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user__text span { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapsed rail (desktop, remembered) */
html.app-rail .app-sidebar { width: var(--app-sidebar-rail); }
html.app-rail .app-main { padding-left: var(--app-sidebar-rail); }
html.app-rail .app-sidebar :is(.app-nav__label, .app-nav__link > span, .app-nav__badge, .app-nav__plan, .app-workspace__text, .app-workspace > .app-icon, .app-user__text, .app-upgrade, .app-chev, .app-logo .trustcheck-logo text) { display: none; }
html.app-rail .app-nav__label { height: 12px; }
html.app-rail .app-nav__link { justify-content: center; padding: 0; }
html.app-rail .app-nav__link .app-nav__dot { position: absolute; top: 6px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); display: block; }
html.app-rail .app-workspace { justify-content: center; padding: 6px; border-color: transparent; background: transparent; box-shadow: none; }
html.app-rail .app-sidebar__head { justify-content: center; padding: 0; }
html.app-rail .app-logo { width: 28px; overflow: hidden; justify-content: flex-start; }
/* Keep the logo at full size so the 28px window shows the whole shield (a squeezed SVG shrank to a dot) */
html.app-rail .app-logo .trustcheck-logo { flex: 0 0 auto; width: auto; max-width: none; height: 28px; }
html.app-rail .app-user { justify-content: center; }
html.app-rail .app-nav details .app-nav__sub { margin-left: 0; padding-left: 0; border: 0; }
.app-nav__dot { display: none; }

.app-main { padding-left: var(--app-sidebar); min-height: 100dvh; display: flex; flex-direction: column; transition: padding-left 0.2s var(--ease); }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--app-topbar);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 0 12px;
    background: var(--topbar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.app-topbar__sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; flex: 0 0 auto; }
.app-crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; min-width: 0; flex: 0 1 auto; }
.app-crumbs a, .app-crumbs span { white-space: nowrap; }
.app-crumbs a { color: var(--muted-foreground); text-decoration: none; }
.app-crumbs a:hover { color: var(--foreground); }
.app-crumbs .app-icon { color: var(--muted-foreground); }
.app-crumbs [aria-current] { color: var(--foreground); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.app-topbar__right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.app-search-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; width: 260px; padding: 0 8px 0 10px; border-radius: var(--radius-md); border: 1px solid var(--input); background: var(--background); color: var(--muted-foreground); font-size: 14px; box-shadow: var(--shadow-xs); cursor: pointer; transition: border-color 0.15s var(--ease); }
.app-search-btn:hover { border-color: var(--border-strong); color: var(--foreground); }
.app-search-btn span { flex: 1 1 auto; text-align: left; }
.app-kbd { display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); font-family: var(--mono); font-size: 11px; font-weight: 500; line-height: 1; }
.app-icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 0.15s var(--ease);
}
.app-icon-btn:hover { background: var(--accent); }
.app-icon-btn__count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: var(--brand-fg); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--background); font-variant-numeric: tabular-nums; }
.app-theme-btn .app-theme-sun { display: none; }
html[data-theme="dark"] .app-theme-btn .app-theme-sun { display: inline-block; }
html[data-theme="dark"] .app-theme-btn .app-theme-moon { display: none; }
.app-avatar-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 4px; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; color: var(--foreground); }
.app-avatar-btn:hover { background: var(--accent); }

.app-content { flex: 1 0 auto; width: 100%; padding: 28px 32px 56px; }
.app-content__inner { max-width: 1240px; margin-inline: auto; }
.app-content--narrow .app-content__inner { max-width: 860px; }
.app-footer { padding: 16px 32px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.app-footer a { color: var(--muted-foreground); text-decoration: none; }
.app-footer a:hover { color: var(--foreground); }
.app-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 1035; opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease); }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); width: min(288px, 86vw); box-shadow: var(--shadow-lg); }
    html.app-nav-open .app-sidebar { transform: none; }
    html.app-nav-open .app-overlay { opacity: 1; pointer-events: auto; }
    html.app-nav-open, html.app-nav-open body { overflow: hidden; }
    .app-sidebar__close.app-icon-btn { display: inline-grid; }
    .app-main, html.app-rail .app-main { padding-left: 0; }
    html.app-rail .app-sidebar { width: min(288px, 86vw); }
    .app-search-btn { width: 36px; padding: 0; justify-content: center; }
    .app-search-btn span, .app-search-btn .app-kbd { display: none; }
    .app-content { padding: 20px 16px 48px; }
    .app-footer { padding: 16px; }
}
@media (max-width: 575.98px) {
    .app-crumbs a, .app-crumbs .app-icon, .app-topbar__sep { display: none; }
    .app-hide-sm { display: none !important; }
}

/* Dropdown menu (avatar menu and any [data-app-menu]) */
.app-menu-wrap { position: relative; }
.app-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 240px;
    padding: 4px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.14s var(--ease), transform 0.18s var(--ease-out);
}
.app-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.app-menu--up { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; transform-origin: bottom left; }
.app-menu__label { padding: 8px 10px 6px; display: grid; line-height: 1.35; }
.app-menu__label strong { font-size: 13px; font-weight: 600; }
.app-menu__label span { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; }
.app-menu__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font-size: 14px; text-align: left; cursor: pointer; }
.app-menu__item:hover, .app-menu__item:focus-visible { background: var(--accent); outline: none; }
.app-menu__item .app-icon { color: var(--muted-foreground); }
.app-menu__item .app-kbd { margin-left: auto; }
.app-menu__item--danger { color: var(--bad-ink); }
.app-menu__item--danger .app-icon { color: currentColor; }
.app-menu__sep { height: 1px; background: var(--border); margin: 4px -4px; }

/* =========================================================================
   Page layout: .app-page-head, .app-grid, .app-stack, .app-row
   ========================================================================= */
.app-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.app-page-head__text { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.app-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.app-title { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; }
.app-subtitle { color: var(--muted-foreground); font-size: 14px; max-width: 68ch; }
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-section-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.app-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.app-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.app-stack--lg { gap: 24px; }
.app-stack--sm { gap: 8px; }
.app-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.app-row--between { justify-content: space-between; }
.app-grid { display: grid; gap: 16px; align-items: start; }
.app-grid > * { min-width: 0; }
.app-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.app-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app-grid--aside { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.app-grid--stretch { align-items: stretch; }
@media (max-width: 1199.98px) { .app-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .app-grid--aside { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 991.98px) { .app-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .app-grid--2, .app-grid--3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 479.98px) { .app-grid--4 { grid-template-columns: minmax(0, 1fr); } }

/* =========================================================================
   Card: .app-card > .app-card__head (.app-card__title, .app-card__desc) / .app-card__body / .app-card__foot
   ========================================================================= */
.app-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); min-width: 0; }
.app-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.app-card__head > div:first-child { display: grid; gap: 4px; min-width: 0; }
.app-card__title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; display: flex; align-items: center; gap: 8px; }
.app-card__title .app-icon { color: var(--muted-foreground); }
.app-card__desc { font-size: 13px; color: var(--muted-foreground); }
.app-card__body { padding: 20px; }
.app-card__head + .app-card__body { padding-top: 16px; }
.app-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--subtle); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.app-card__foot--end { justify-content: flex-end; }
.app-card--flush > .app-card__body { padding: 0; }
.app-card--hover { transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease); }
.app-card--hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.app-card--muted { background: var(--subtle); box-shadow: none; }
.app-card--brand { border-color: var(--brand-line); background: var(--brand-soft); }
.app-card--danger { border-color: var(--bad-line); }
.app-card__divider { height: 1px; background: var(--border); margin: 0; border: 0; }

/* Static stat tile (use TC UI stat-card when there is a trend line) */
.app-stat { display: grid; gap: 6px; padding: 16px 18px; }
.app-stat__label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.app-stat__label .app-icon { color: var(--muted-foreground); }
.app-stat__value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.app-stat__value small { font-size: 14px; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0; }
.app-stat__meta { font-size: 12px; color: var(--muted-foreground); }

/* =========================================================================
   Buttons: .app-btn [--primary default | --secondary | --outline | --ghost | --brand | --danger | --link] [--sm | --lg | --icon | --block]
   ========================================================================= */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: var(--shadow-xs);
    transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
    -webkit-user-select: none;
    user-select: none;
}
.app-btn:hover { background: var(--primary-hover); color: var(--primary-foreground); }
.app-btn:active { transform: translateY(1px); }
.app-btn:disabled, .app-btn.is-disabled { opacity: 0.5; pointer-events: none; }
.app-btn .app-icon { margin: 0 -2px; }
.app-btn--secondary { background: var(--muted); color: var(--foreground); box-shadow: none; }
.app-btn--secondary:hover { background: var(--border); color: var(--foreground); }
.app-btn--outline { background: var(--background); color: var(--foreground); border-color: var(--input); }
.app-btn--outline:hover { background: var(--accent); color: var(--foreground); }
.app-btn--ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.app-btn--ghost:hover { background: var(--accent); color: var(--foreground); }
.app-btn--brand { background: var(--brand); color: var(--brand-fg); }
.app-btn--brand:hover { background: var(--brand-hover); color: var(--brand-fg); }
.app-btn--danger { background: var(--destructive); color: #fff; }
.app-btn--danger:hover { background: var(--bad-ink); color: #fff; }
.app-btn--danger-outline { background: var(--background); color: var(--bad-ink); border-color: var(--bad-line); box-shadow: none; }
.app-btn--danger-outline:hover { background: var(--bad-soft); color: var(--bad-ink); }
.app-btn--link { background: transparent; color: var(--foreground); box-shadow: none; padding: 0; height: auto; text-decoration: underline !important; text-decoration-color: var(--border-strong) !important; text-underline-offset: 4px; }
.app-btn--link:hover { background: transparent; color: var(--foreground); text-decoration-color: currentColor !important; }
.app-btn--sm { height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.app-btn--xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 4px; border-radius: var(--radius-sm); }
.app-btn--lg { height: 40px; padding: 0 18px; }
.app-btn--icon { width: 36px; padding: 0; }
.app-btn--icon.app-btn--sm { width: 32px; }
.app-btn--block { width: 100%; }
.app-btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.app-btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--primary-foreground) transparent var(--primary-foreground) transparent; animation: app-spin 0.7s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }

/* =========================================================================
   Forms: .app-form > .app-field > (.app-label, .app-input | .app-select | .app-textarea, .app-hint, .app-error)
   ========================================================================= */
.app-form { display: grid; gap: 18px; }
.app-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.app-form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .app-form-row, .app-form-row--3 { grid-template-columns: minmax(0, 1fr); } }
.app-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.app-label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--foreground); margin: 0; line-height: 1.4; }
.app-label small, .app-label .app-optional { font-size: 12px; font-weight: 400; color: var(--muted-foreground); }
.app-label .app-req { color: var(--bad); }
.app-label__aside { margin-left: auto; font-size: 13px; font-weight: 400; }
.app-hint { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.45; }
.app-hint > .app-icon:first-child { margin-right: 4px; vertical-align: -2px; }
.app-error { font-size: 12.5px; color: var(--bad-ink); }
.app-input, .app-select, .app-textarea {
    display: block;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: var(--background);
    color: var(--foreground);
    font-size: 14px;
    line-height: 1.4;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    -webkit-appearance: none;
    appearance: none;
}
.app-textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.app-input::placeholder, .app-textarea::placeholder { color: var(--muted-foreground); opacity: 1; }
.app-input:hover, .app-select:hover, .app-textarea:hover { border-color: var(--border-strong); }
.app-input:focus, .app-select:focus, .app-textarea:focus { outline: none; border-color: var(--ring); box-shadow: var(--ring-shadow); }
.app-input[readonly], .app-input:disabled, .app-select:disabled, .app-textarea[readonly] { background: var(--muted); color: var(--muted-foreground); box-shadow: none; cursor: default; }
.app-input[readonly]:hover { border-color: var(--input); }
.app-input.is-invalid, .app-select.is-invalid, .app-textarea.is-invalid { border-color: var(--bad); }
.app-select { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.app-input[type="file"] { padding: 6px; height: auto; }
.app-input[type="file"]::file-selector-button { margin-right: 10px; border: 0; border-radius: var(--radius-sm); background: var(--muted); color: var(--foreground); padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.app-input-group { position: relative; display: flex; align-items: stretch; }
.app-input-group > .app-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.app-input-group > .app-icon ~ .app-input { padding-left: 36px; }
.app-input-group__addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--input); background: var(--muted); color: var(--muted-foreground); font-size: 14px; white-space: nowrap; }
.app-input-group__addon:first-child { border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.app-input-group__addon:first-child + .app-input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.app-input-group__addon:last-child { border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.app-input-group .app-input:has(+ .app-input-group__addon) { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.app-input-group__btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.app-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; line-height: 1.45; }
.app-check input[type="checkbox"], .app-check input[type="radio"] { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
.app-check small { display: block; color: var(--muted-foreground); font-size: 12.5px; }
.app-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 12px; }
.app-fieldset > legend { float: none; width: auto; padding: 0; margin: 0 0 4px; font-size: 14px; font-weight: 500; }
.app-form-sections { container-type: inline-size; }
.app-form-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--border); }
.app-form-section:first-child { border-top: 0; padding-top: 0; }
.app-form-section__text { display: grid; gap: 4px; align-content: start; }
.app-form-section__text h3 { font-size: 14px; font-weight: 600; }
.app-form-section__text p { font-size: 13px; color: var(--muted-foreground); }
@media (max-width: 860px) { .app-form-section { grid-template-columns: minmax(0, 1fr); gap: 12px; } }
@container (max-width: 760px) { .app-form-section { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* Choice cards (radio as a card) */
.app-choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); cursor: pointer; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease); }
.app-choice:hover { border-color: var(--border-strong); }
.app-choice:has(input:checked) { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }
.app-choice input { accent-color: var(--primary); margin-top: 3px; }

/* =========================================================================
   Badges: .app-badge [--success | --warning | --danger | --info | --brand | --outline | --solid]
   ========================================================================= */
.app-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--muted); color: var(--foreground); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; }
.app-badge .app-icon { width: 12px; height: 12px; }
.app-badge--outline { background: transparent; }
.app-badge--solid { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.app-badge--success { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok-line); }
.app-badge--warning { background: var(--wait-soft); color: var(--wait-ink); border-color: var(--wait-line); }
.app-badge--danger { background: var(--bad-soft); color: var(--bad-ink); border-color: var(--bad-line); }
.app-badge--info { background: var(--info-soft); color: var(--info-ink); border-color: var(--info-line); }
.app-badge--brand { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-line); }
.app-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.app-badge--live .app-dot { animation: app-pulse 1.8s ease-in-out infinite; }
@keyframes app-pulse { 50% { opacity: 0.35; } }

/* =========================================================================
   Alerts: .app-alert [--info | --success | --warning | --danger | --brand] > .app-icon + div(strong, p)
   ========================================================================= */
.app-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); font-size: 14px; }
.app-alert > .app-icon { margin-top: 2px; color: var(--muted-foreground); }
.app-alert > div { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.app-alert strong { font-weight: 600; }
.app-alert p { color: var(--muted-foreground); font-size: 13.5px; }
.app-alert__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.app-alert--info { background: var(--info-soft); border-color: var(--info-line); }
.app-alert--info > .app-icon, .app-alert--info strong { color: var(--info-ink); }
.app-alert--success { background: var(--ok-soft); border-color: var(--ok-line); }
.app-alert--success > .app-icon, .app-alert--success strong { color: var(--ok-ink); }
.app-alert--warning { background: var(--wait-soft); border-color: var(--wait-line); }
.app-alert--warning > .app-icon, .app-alert--warning strong { color: var(--wait-ink); }
.app-alert--danger { background: var(--bad-soft); border-color: var(--bad-line); }
.app-alert--danger > .app-icon, .app-alert--danger strong { color: var(--bad-ink); }
.app-alert--brand { background: var(--brand-soft); border-color: var(--brand-line); }
.app-alert--brand > .app-icon, .app-alert--brand strong { color: var(--brand-ink); }
.app-alert:is(.app-alert--info, .app-alert--success, .app-alert--warning, .app-alert--danger, .app-alert--brand) p { color: var(--foreground); opacity: 0.8; }

/* =========================================================================
   Tables: .app-table-wrap > table.app-table (td[data-label] turn into cards on phones)
   ========================================================================= */
.app-table-wrap { width: 100%; overflow-x: auto; }
.app-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.app-table th { height: 40px; padding: 0 16px; text-align: left; font-weight: 500; font-size: 13px; color: var(--muted-foreground); border-bottom: 1px solid var(--border); white-space: nowrap; background: transparent; }
.app-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--foreground); }
.app-table tbody tr { transition: background-color 0.12s var(--ease); }
.app-table tbody tr:hover { background: var(--row-hover); }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table .app-table__num { text-align: right; font-variant-numeric: tabular-nums; }
.app-table .app-table__actions { text-align: right; white-space: nowrap; }
.app-table__primary { font-weight: 500; }
.app-table__sub { display: block; font-size: 12.5px; color: var(--muted-foreground); }
@media (max-width: 767.98px) {
    .app-table--stack thead { display: none; }
    .app-table--stack, .app-table--stack tbody, .app-table--stack tr, .app-table--stack td { display: block; width: 100%; }
    .app-table--stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .app-table--stack tr:last-child { border-bottom: 0; }
    .app-table--stack td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .app-table--stack td[data-label]::before { content: attr(data-label); color: var(--muted-foreground); font-size: 13px; text-align: left; flex: 0 0 auto; }
    .app-table--stack td.app-table__actions { justify-content: flex-end; padding-top: 8px; }
}

/* =========================================================================
   Lists: .app-list > .app-list__item (icon, text, meta, chevron). Use <a> for a link row.
   ========================================================================= */
.app-list { display: grid; }
.app-list__item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--foreground); min-width: 0; }
.app-list__item:first-child { border-top: 0; }
a.app-list__item:hover, button.app-list__item:hover { background: var(--row-hover); }
button.app-list__item { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; text-align: left; cursor: pointer; }
.app-list__icon { width: 32px; height: 32px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--card); display: grid; place-items: center; flex: 0 0 auto; color: var(--foreground); }
.app-list__text { display: grid; gap: 1px; min-width: 0; flex: 1 1 auto; }
.app-list__text strong { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.app-list__text span { font-size: 13px; color: var(--muted-foreground); }
.app-list__meta { margin-left: auto; flex: 0 0 auto; font-size: 13px; color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; }
.app-list__item > .app-icon:last-child { color: var(--muted-foreground); }
.app-list--compact .app-list__item { padding: 10px 16px; }

/* Key/value rows */
.app-dl { display: grid; gap: 0; margin: 0; }
.app-dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.app-dl > div:first-child { border-top: 0; padding-top: 0; }
.app-dl dt { font-weight: 400; color: var(--muted-foreground); }
.app-dl dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

/* =========================================================================
   Misc: avatar, progress, empty state, tabs (links), code block, skeleton, rating stars, pagination, modal
   ========================================================================= */
.app-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; background: var(--muted); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--foreground); border: 1px solid var(--border); }
.app-avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-avatar--sm { width: 28px; height: 28px; }
.app-avatar--lg { width: 64px; height: 64px; font-size: 18px; }
.app-avatar--xl { width: 88px; height: 88px; font-size: 24px; }
.app-avatar--square { border-radius: var(--radius-lg); }

.app-progress { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.app-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.6s var(--ease-out); }
.app-progress--brand > span { background: var(--brand); }
.app-progress--success > span { background: var(--ok); }
.app-progress--warning > span { background: var(--wait); }
.app-progress--danger > span { background: var(--bad); }

.app-empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 20px; }
.app-empty__icon { width: 48px; height: 48px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm); display: grid; place-items: center; color: var(--muted-foreground); margin-bottom: 6px; }
.app-empty h3 { font-size: 15px; font-weight: 600; }
.app-empty p { font-size: 14px; color: var(--muted-foreground); max-width: 44ch; }
.app-empty .app-actions { margin-top: 8px; justify-content: center; }
.app-card .app-empty { border: 0; }
.app-empty--dashed { border: 1px dashed var(--border-strong); border-radius: var(--radius-xl); }

.app-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-lg); background: var(--muted); max-width: 100%; overflow-x: auto; }
.app-tabs a, .app-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--muted-foreground); font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.app-tabs a:hover, .app-tabs button:hover { color: var(--foreground); }
.app-tabs .is-active, .app-tabs [aria-current], .app-tabs [aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.app-tabs .app-badge { height: 18px; padding: 0 6px; font-size: 11px; }

.app-code { position: relative; display: block; margin: 0; padding: 14px 48px 14px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--subtle); color: var(--foreground); font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto; }
.app-code-wrap { position: relative; }
.app-code-wrap .app-copy { position: absolute; top: 8px; right: 8px; }

.app-skeleton { display: block; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--muted), var(--accent), var(--muted)); background-size: 200% 100%; animation: app-shimmer 1.4s ease-in-out infinite; }
@keyframes app-shimmer { to { background-position: -200% 0; } }

.app-stars { display: inline-flex; gap: 1px; color: var(--brand); vertical-align: middle; }
.app-stars .app-icon { fill: currentColor; }
.app-stars .is-off { color: var(--border-strong); fill: currentColor; }

.app-pagination, .app-body .pagination { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 16px 0 0; padding: 0; list-style: none; }
.app-body .pagination .page-item .page-link { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--radius-md) !important; border: 1px solid transparent; background: transparent; color: var(--foreground); font-size: 14px; box-shadow: none; }
.app-body .pagination .page-item .page-link:hover { background: var(--accent); }
.app-body .pagination .page-item.active .page-link { border-color: var(--border); background: var(--background); box-shadow: var(--shadow-xs); font-weight: 600; }
.app-body .pagination .page-item.disabled .page-link { color: var(--muted-foreground); opacity: 0.6; }

.app-body .modal-content { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.app-body .modal-header { border-bottom: 0; padding: 20px 20px 0; align-items: flex-start; }
.app-body .modal-title { font-size: 16px; font-weight: 600; }
.app-body .modal-body { padding: 16px 20px; }
.app-body .modal-footer { border-top: 0; padding: 0 20px 20px; gap: 8px; }
.app-body .modal-footer > * { margin: 0; }
.app-body .btn-close { filter: none; opacity: 0.6; }
html[data-theme="dark"] .app-body .btn-close { filter: invert(1); }
.app-body .modal-backdrop.show { opacity: 0.55; }

/* Toast stack for partials/notify (iziToast is skinned to match) */
.app-body .iziToast { font-family: var(--font) !important; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-lg) !important; }

/* Score ring (trust score) */
.app-score { --pct: 0; --score-color: var(--brand); position: relative; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--score-color) calc(var(--pct) * 1%), var(--muted) 0); flex: 0 0 auto; }
.app-score::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.app-score > * { position: relative; }
.app-score__value { display: grid; justify-items: center; line-height: 1; }
.app-score__value strong { font-size: 32px; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.app-score__value span { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }
.app-score--excellent { --score-color: #16a34a; }
.app-score--great { --score-color: #65a30d; }
.app-score--good { --score-color: #ca8a04; }
.app-score--average { --score-color: #ea580c; }
.app-score--poor { --score-color: #dc2626; }
.app-score--new { --score-color: #a1a1aa; }

/* Review item */
.app-review { display: grid; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }
.app-review:first-child { border-top: 0; }
.app-review__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-review__who { display: grid; min-width: 0; line-height: 1.3; flex: 1 1 auto; }
.app-review__who strong { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-review__who span { font-size: 12px; color: var(--muted-foreground); }
.app-review__body { font-size: 14px; color: var(--foreground); line-height: 1.55; overflow-wrap: anywhere; }
.app-review__title { font-weight: 600; }

/* Brand logos rendered by partials/tc_logo stay crisp on the new surfaces */
.app-body .tc-logo { border-radius: var(--radius-lg) !important; }

/* TC UI components inside the app pick up the app font */
.app-body [data-tcui] { font-family: var(--font); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .app-body *, .app-body *::before, .app-body *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =========================================================================
   Sign-in pages (layouts/app_auth): .auth > .auth__main (top, body > .auth__card, foot) + .auth__aside
   Inside the card: .auth-head (mark, h1, p), .auth-social, .auth-divider, .app-form, .auth-alt
   ========================================================================= */
.auth-body { background: var(--background); }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); min-height: 100dvh; }
.auth__main { display: flex; flex-direction: column; min-width: 0; padding: 20px 32px; }
.auth__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.auth__top .app-logo svg { height: 28px; }
.auth__top-link { font-size: 14px; color: var(--muted-foreground); display: inline-flex; align-items: center; gap: 4px; }
.auth__top-link a, .auth__top-link .au-logout button { color: var(--foreground); font-weight: 500; padding: 6px 10px; border-radius: var(--radius-md); }
.auth__top-link a:hover, .auth__top-link .au-logout button:hover { background: var(--accent); }
/* Log out is a POST form: the button is styled as the link it replaced */
.au-logout { display: inline; }
.au-logout button { background: none; border: 0; font: inherit; cursor: pointer; }
.au-logout--btn { display: block; }
.au-logout--btn button { font: inherit; }
.app-menu__form { display: contents; }
.auth__body { flex: 1 0 auto; display: grid; place-items: center; padding: 40px 0; }
.auth__card { width: 100%; max-width: 400px; display: grid; gap: 22px; }
.auth__card--wide { max-width: 520px; }
.auth__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 12.5px; color: var(--muted-foreground); }
.auth__foot a { color: var(--muted-foreground); text-decoration: none; }
.auth__foot a:hover { color: var(--foreground); }

.auth-head { display: grid; gap: 8px; }
.auth-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--brand-fg); box-shadow: 0 8px 24px -10px rgba(245, 166, 35, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.4); margin-bottom: 8px; }
.auth-mark--muted { background: var(--muted); color: var(--foreground); box-shadow: none; border: 1px solid var(--border); }
.auth-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.auth-head p { color: var(--muted-foreground); font-size: 14.5px; line-height: 1.55; }
.auth-head p strong { color: var(--foreground); font-weight: 500; overflow-wrap: anywhere; }
.auth-social { display: grid; gap: 8px; }
.auth-social .app-btn { height: 40px; }
.auth-social img { width: 18px; height: 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--border); }
.auth-alt { font-size: 14px; color: var(--muted-foreground); text-align: center; }
.auth-alt a { color: var(--foreground); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px; }
.auth-alt a:hover { text-decoration-color: currentColor; }
.auth-note { font-size: 12.5px; color: var(--muted-foreground); text-align: center; line-height: 1.5; }
.auth-note a { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.auth .app-input, .auth .app-select { height: 40px; }
.auth .app-btn--submit { height: 40px; width: 100%; }

/* Password field with a show/hide button: .auth-pw > .app-input + button[data-toggle-password] */
.auth-pw { position: relative; }
.auth-pw .app-input { padding-right: 44px; }
.auth-pw > button { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); display: grid; place-items: center; cursor: pointer; }
.auth-pw > button:hover { color: var(--foreground); background: var(--accent); }
.auth-pw > button .auth-pw__hide, .auth-pw > button.is-shown .auth-pw__show { display: none; }
.auth-pw > button.is-shown .auth-pw__hide { display: inline-block; }
.auth-pw .app-input-group > .app-icon ~ .app-input { padding-left: 36px; }
/* Password rules list appended by secure_password.js */
.auth-pw .input-popup { display: none; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--subtle); font-size: 12.5px; gap: 4px; }
.auth-pw.hover-input-popup .input-popup { display: grid; }
.auth-pw .input-popup p { margin: 0; display: flex; gap: 8px; align-items: center; color: var(--muted-foreground); }
.auth-pw .input-popup p::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex-shrink: 0; }
.auth-pw .input-popup p.success { color: var(--ok-ink); }
.auth-pw .input-popup p.success::before { background: var(--ok); border-color: var(--ok); }

/* Legacy captcha partial markup (.form-group / .form-control) */
.auth .form-group { display: grid; gap: 6px; margin: 0; }
.auth .form-group .form-label, .auth .form-group label { font-size: 14px; font-weight: 500; margin: 0; color: var(--foreground); }
.auth .form-group .form-control { height: 40px; border-radius: var(--radius-md); border: 1px solid var(--input); background: var(--background); color: var(--foreground); font-size: 14px; box-shadow: var(--shadow-xs); }
.auth .form-group .form-control:focus { border-color: var(--ring); box-shadow: var(--ring-shadow); }
.auth .text--danger { color: var(--bad-ink); font-size: 12.5px; }

/* select2 inside the app (country pickers) */
.app-body .select2-container { width: 100% !important; }
.app-body .select2-container--default .select2-selection--single { height: 40px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background); display: flex; align-items: center; box-shadow: var(--shadow-xs); }
.app-body .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--foreground); font-size: 14px; padding: 0 36px 0 12px; line-height: 1.4; }
.app-body .select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; right: 8px; }
.app-body .select2-container--default.select2-container--focus .select2-selection--single,
.app-body .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--ring); box-shadow: var(--ring-shadow); }
.app-body .select2-dropdown { background: var(--card); border: 1px solid var(--border) !important; border-radius: var(--radius-md) !important; box-shadow: var(--shadow-lg); overflow: hidden; color: var(--foreground); font-family: var(--font); }
.app-body .select2-search--dropdown { padding: 6px; }
.app-body .select2-search--dropdown .select2-search__field { height: 36px; border: 1px solid var(--input) !important; border-radius: var(--radius-sm); padding: 0 10px; background: var(--background); color: var(--foreground); font-size: 14px; }
.app-body .select2-results__option { padding: 8px 12px; font-size: 14px; }
.app-body .select2-container--default .select2-results__option--highlighted[aria-selected],
.app-body .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--accent); color: var(--foreground); }
.app-body .select2-container--default .select2-results__option[aria-selected="true"],
.app-body .select2-container--default .select2-results__option--selected { background: var(--brand-soft); color: var(--foreground); }

/* The aside: always dark, dot grid, a sample trust card and three reasons */
.auth__aside { position: sticky; top: 12px; height: calc(100dvh - 24px); overflow: hidden; margin: 12px; border-radius: 20px; background: #0b0b0c; color: #fafafa; display: grid; align-content: center; padding: 56px; isolation: isolate; }
.auth__aside::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px); background-size: 22px 22px; mask-image: radial-gradient(ellipse 80% 70% at 60% 40%, #000 40%, transparent 100%); -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 40%, #000 40%, transparent 100%); }
.auth__aside::after { content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; right: -160px; top: -200px; border-radius: 50%; background: radial-gradient(closest-side, rgba(245, 166, 35, 0.28), transparent); }
.auth-side { display: grid; gap: 32px; max-width: 460px; }
.auth-side h2 { color: #fafafa; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.auth-side h2 em { font-style: normal; color: #f5a623; }
.auth-side ul { list-style: none; display: grid; gap: 18px; }
.auth-side li { display: flex; gap: 14px; align-items: flex-start; }
.auth-side li .app-icon { flex: 0 0 auto; width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); color: #f5a623; }
.auth-side li strong { display: block; color: #fafafa; font-weight: 500; font-size: 14.5px; }
.auth-side li span { color: #a1a1aa; font-size: 13.5px; line-height: 1.5; }
.auth-sample { display: grid; gap: 12px; padding: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.auth-sample__head { display: flex; align-items: center; gap: 12px; }
.auth-sample__logo { width: 40px; height: 40px; border-radius: 10px; background: #f5a623; color: #15140f; display: grid; place-items: center; font-weight: 700; }
.auth-sample__name { display: grid; line-height: 1.3; flex: 1 1 auto; }
.auth-sample__name strong { font-weight: 600; font-size: 14.5px; }
.auth-sample__name span { font-size: 12px; color: #a1a1aa; }
.auth-sample__score { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: #5fd39b; font-variant-numeric: tabular-nums; }
.auth-sample__score small { font-size: 12px; color: #a1a1aa; font-weight: 400; letter-spacing: 0; }
.auth-sample__bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.auth-sample__bar span { display: block; height: 100%; width: 86%; border-radius: inherit; background: #5fd39b; }
.auth-sample__quote { font-size: 13.5px; color: #d4d4d8; line-height: 1.55; }
.auth-sample__quote b { color: #fafafa; font-weight: 500; }
.auth-sample .app-badge { background: rgba(34, 197, 94, 0.12); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }

@media (max-width: 1023.98px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth__aside { display: none; }
}
@media (max-width: 480px) {
    .auth__main { padding: 16px; }
    .auth__body { padding: 28px 0; place-items: start center; }
    .auth-head h1 { font-size: 23px; }
}

/* Shared public partials (tc-alert) shown inside the app: same look as .app-alert. Line Awesome is not loaded here. */
.app-body .tc-alert { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); color: var(--foreground); font-size: 13px; line-height: 1.55; }
.app-body .tc-alert > i.las { display: none; }
.app-body .tc-alert strong { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.app-body .tc-alert--bad { background: var(--bad-soft); border-color: var(--bad-line); }
.app-body .tc-alert--bad strong { color: var(--bad-ink); }
.app-body .tc-alert--info { background: var(--info-soft); border-color: var(--info-line); }
.app-body .tc-alert--info strong { color: var(--info-ink); }
.app-body .tc-alert--warn, .app-body .tc-alert--wait { background: var(--wait-soft); border-color: var(--wait-line); }
.app-body .tc-alert--ok { background: var(--ok-soft); border-color: var(--ok-line); }
.app-body .tc-alert .tc-link { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.app-body .tc-not-club-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }

/* Toasts (partials/notify, iziToast) in the app: a card with a coloured edge, no icon font */
.app-body .iziToast.app-toast { border: 1px solid var(--border); border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-lg) !important; padding: 10px 40px 10px 14px; min-height: 0; }
.app-body .iziToast.app-toast::after { display: none; }
.app-body .iziToast.app-toast > .iziToast-body { padding-left: 0 !important; margin-left: 0 !important; }
.app-body .iziToast.app-toast .iziToast-title { font-weight: 600; }
.app-body .iziToast.app-toast .iziToast-title::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 0; border-radius: 50%; background: var(--app-toast-edge, var(--info)); }
.app-body .iziToast.app-toast > .iziToast-close { background: none; opacity: 0.6; width: 32px; }
.app-body .iziToast.app-toast > .iziToast-close::before, .app-body .iziToast.app-toast > .iziToast-close::after { content: ""; position: absolute; top: 50%; left: 50%; width: 12px; height: 1.5px; background: var(--foreground); }
.app-body .iziToast.app-toast > .iziToast-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.app-body .iziToast.app-toast > .iziToast-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.app-toast--success { --app-toast-edge: var(--ok); }
.app-toast--error { --app-toast-edge: var(--bad); }
.app-toast--warning { --app-toast-edge: var(--wait); }

/* Checkboxes and radios drawn by the app (consistent in both themes) */
.app-body input[type="checkbox"]:not(.app-sr):not([data-tcui] *), .app-body input[type="radio"]:not(.app-sr):not([data-tcui] *) { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--background); box-shadow: var(--shadow-xs); display: inline-grid; place-items: center; cursor: pointer; transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease); }
.app-body input[type="radio"]:not(.app-sr):not([data-tcui] *) { border-radius: 50%; }
.app-body input[type="checkbox"]:not(.app-sr):not([data-tcui] *)::after { content: ""; width: 9px; height: 5px; border: solid var(--primary-foreground); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform 0.12s var(--ease); }
.app-body input[type="radio"]:not(.app-sr):not([data-tcui] *)::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary-foreground); transform: scale(0); transition: transform 0.12s var(--ease); }
.app-body input:is([type="checkbox"], [type="radio"]):not(.app-sr):not([data-tcui] *):checked { background: var(--primary); border-color: var(--primary); }
.app-body input[type="checkbox"]:not(.app-sr):not([data-tcui] *):checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.app-body input[type="radio"]:not(.app-sr):not([data-tcui] *):checked::after { transform: scale(1); }
.app-body input:is([type="checkbox"], [type="radio"]):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.app-body input:is([type="checkbox"], [type="radio"]):disabled { opacity: 0.5; cursor: not-allowed; }

/* One-time code boxes (TC UI otp-input inside the app) */
.app-otp { display: flex; gap: 8px; width: 100%; min-width: 0; }
.app-otp input:not([type=hidden]) { flex: 1 1 0; width: 0; min-width: 0; height: 52px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); font-family: var(--mono); font-size: 20px; font-weight: 500; text-align: center; caret-color: var(--brand); }
.app-otp input:not([type=hidden]):focus { border-color: var(--ring); box-shadow: var(--ring-shadow); outline: none; }
.app-otp.is-invalid input:not([type=hidden]) { border-color: var(--bad); }
.auth-pw > button { top: 20px; }
.auth-mark--bad { background: var(--bad-soft); color: var(--bad-ink); box-shadow: none; border: 1px solid var(--bad-line); }

/* Segmented radio control: .app-seg > label > input[type=radio] + span */
.app-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: var(--radius-lg); background: var(--muted); }
.app-seg > label { position: relative; margin: 0; cursor: pointer; }
.app-seg input { position: absolute; opacity: 0; pointer-events: none; }
.app-seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 4px 12px; border-radius: var(--radius-md); color: var(--muted-foreground); font-size: 13.5px; font-weight: 500; }
.app-seg label:hover span { color: var(--foreground); }
.app-seg input:checked + span { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.app-seg input:focus-visible + span { box-shadow: var(--ring-shadow); }

/* Pressable option card (button with aria-pressed or .is-active) */
.app-option { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--foreground); cursor: pointer; }
.app-option:hover { border-color: var(--border-strong); }
.app-option:focus-visible { outline: none; box-shadow: var(--ring-shadow); }
.app-option.is-active, .app-option[aria-pressed="true"] { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }

.app-card__body--flush { padding: 0 0 4px; }
.app-card__body--flush .app-table th:first-child, .app-card__body--flush .app-table td:first-child { padding-left: 20px; }
.app-card__body--flush .app-table th:last-child, .app-card__body--flush .app-table td:last-child { padding-right: 20px; }

/* WhatsApp brand button */
.app-btn--whatsapp { background: #25d366; color: #0b141a; }
.app-btn--whatsapp:hover { background: #1fbe5a; color: #0b141a; }

/* Tag/chip input: .app-tags > .app-tag(s) + input */
.app-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 8px; border-radius: var(--radius-md); border: 1px solid var(--input); background: var(--background); box-shadow: var(--shadow-xs); cursor: text; }
.app-tags:focus-within { border-color: var(--ring); box-shadow: var(--ring-shadow); }
.app-tag { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--muted); font-size: 13px; font-weight: 500; }

/* Small score ring */
.app-score--sm { width: 84px; height: 84px; }
.app-score--sm::before { inset: 7px; }
.app-score--sm .app-score__value strong { font-size: 24px; }

/* Table directly inside a card body; plan feature list */
.app-card__body--table { padding: 8px 0 0; }
.app-feats { list-style: none; display: grid; gap: 10px; font-size: 14px; }
.app-feats li { display: flex; gap: 10px; }
.app-feats .app-icon { color: var(--ok); margin-top: 2px; }
.app-feats .is-off { color: var(--muted-foreground); }
.app-body .tcui-an { font-family: inherit; letter-spacing: -0.03em; }
