/* tcui.css */
/* TC UI tokens. Components use only these variables, so they follow the page they sit on:
   the admin theme (light/dark: --background, --card...), the public site (--tc-*), or EasyUI's own dark defaults. */
:root {
    --tcui-bg: var(--background, var(--tc-paper, #151515));
    --tcui-surface: var(--card, var(--tc-surface, #202020));
    --tcui-raised: var(--muted, var(--tc-paper, #2a2a2a));
    --tcui-border: var(--border, var(--tc-line, rgba(255, 255, 255, 0.08)));
    --tcui-border-strong: var(--border-strong, var(--tc-line-strong, rgba(255, 255, 255, 0.16)));
    --tcui-text: var(--foreground, var(--tc-ink, #ededed));
    --tcui-text-2: var(--muted-foreground, var(--tc-ink-2, #a1a1a1));
    --tcui-primary: var(--primary, var(--tc-ink, #ededed));
    --tcui-primary-fg: var(--primary-foreground, var(--tc-on-ink, #ffffff));
    --tcui-accent: #f5a623;          /* TrustCheck amber */
    --tcui-accent-fg: #15140f;
    --tcui-success: #22c55e;
    --tcui-warning: #f59e0b;
    --tcui-danger: var(--destructive, #ef4444);
    --tcui-info: #3b82f6;
    --tcui-ring: var(--ring, #a1a1aa);
    --tcui-radius-sm: 8px;
    --tcui-radius: 12px;
    --tcui-radius-lg: 16px;
    --tcui-radius-xl: 20px;
    --tcui-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px -12px rgba(0, 0, 0, 0.25);
    --tcui-shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.4);
    --tcui-font: var(--font, var(--tc-font, "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif));
    --tcui-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --tcui-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --tcui-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

.tcui-icon { display: inline-block; flex: none; vertical-align: middle; }
.tcui-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; }
[data-tcui] { font-family: var(--tcui-font); box-sizing: border-box; }
[data-tcui] *, [data-tcui] *::before, [data-tcui] *::after { box-sizing: border-box; }
[data-tcui] :focus-visible { outline: 2px solid var(--tcui-ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    [data-tcui] *, [data-tcui] *::before, [data-tcui] *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* The legacy admin app.css paints white text on ANY element whose class contains "bg" (*[class*='bg']).
   Same specificity, loaded later, so components inherit their colour again; their own rules (loaded after this file) still win. */
[data-tcui] :where([class*='bg']) { color: inherit; }

/* Badges keep their final box before the component starts (inline-flex, 24px pill), so a margin or the pill height
   never appears late and moves the page (Lighthouse CLS). Matches .tcui-bd in components/badge. */
[data-tcui="badge"]:not([data-tcui-ready]) { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; line-height: 1; white-space: nowrap; vertical-align: middle; }

/* animated-number.css */
.tcui-an { display: inline-flex; align-items: baseline; font-family: var(--tcui-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: inherit; user-select: none; }
.tcui-an-prefix { margin-right: 0.08em; }
.tcui-an-suffix { margin-left: 0.08em; }
.tcui-an-row { display: inline-flex; align-items: baseline; overflow: hidden; }
.tcui-an-col { position: relative; display: inline-block; overflow: hidden; height: 1.15em; line-height: 1.15em; width: 1ch; text-align: center; }
.tcui-an-strip { display: flex; flex-direction: column; will-change: transform; }
.tcui-an-digit { display: flex; align-items: center; justify-content: center; height: 1.15em; }
.tcui-an-sep { display: inline-block; margin: 0 -0.06em; }

/* command-menu.css */
.tcui-cm-root { display: contents; }
.tcui-cm-overlay { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: flex-start; justify-content: center; padding: 80px 16px 0; }
.tcui-cm-overlay.is-contained { position: absolute; padding-top: 28px; z-index: 30; }
@media (min-width: 640px) { .tcui-cm-overlay { padding-left: 24px; padding-right: 24px; } }
.tcui-cm-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: opacity 0.2s; }
.tcui-cm-overlay:not(.is-contained) .tcui-cm-backdrop { position: fixed; }
.tcui-cm-panel { position: relative; z-index: 10; width: 100%; max-width: 576px; overflow: hidden; border-radius: 12px; border: 1px solid var(--tcui-border); background: var(--tcui-surface); color: var(--tcui-text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); will-change: transform, opacity; font-family: var(--tcui-font); }
.tcui-cm-bar { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--tcui-border); }
.tcui-cm-bar > .tcui-icon { margin-right: 10px; color: var(--tcui-text-2); opacity: 0.75; }
.tcui-cm .tcui-cm-input, .tcui-cm-panel .tcui-cm-input { width: 100%; min-width: 0; height: auto; padding: 0 !important; margin: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; font: 16px/1.4 var(--tcui-font); color: var(--tcui-text); outline: none !important; }
.tcui-cm-input::placeholder { color: var(--tcui-text-2); opacity: 0.85; }
.tcui-cm-kbd { flex: none; font: 10px var(--tcui-mono); padding: 2px 6px; border-radius: 4px; background: var(--tcui-raised); border: 1px solid var(--tcui-border); color: var(--tcui-text-2); }
.tcui-cm-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.tcui-cm-items { display: flex; flex-direction: column; gap: 2px; }
.tcui-cm-empty { padding: 32px 0; text-align: center; font-size: 12px; color: var(--tcui-text-2); }
.tcui-cm-item { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; font: 12px/1.3 var(--tcui-font); color: var(--tcui-text-2); text-align: left; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.tcui-cm-item:hover { background: color-mix(in srgb, var(--tcui-raised) 55%, transparent); }
.tcui-cm-item.is-selected { background: var(--tcui-raised); color: var(--tcui-text); }
.tcui-cm-left, .tcui-cm-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tcui-cm-right { gap: 8px; flex: none; }
.tcui-cm-left > .tcui-icon { color: var(--tcui-text-2); }
.tcui-cm-item.is-selected .tcui-cm-left > .tcui-icon { color: var(--tcui-text); }
.tcui-cm-title { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcui-cm-cat { margin-left: 4px; font-size: 10px; color: var(--tcui-text-2); opacity: 0.7; white-space: nowrap; }
.tcui-cm-enter { color: var(--tcui-text); }
.tcui-cm-short { font: 10px var(--tcui-mono); padding: 2px 6px; border-radius: 4px; background: var(--tcui-surface); border: 1px solid var(--tcui-border); color: var(--tcui-text-2); }
.tcui-cm-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--tcui-border); font-size: 11px; color: var(--tcui-text-2); }
.tcui-cm-foot > div { display: flex; align-items: center; gap: 12px; }
.tcui-cm-foot span.tcui-cm-hint { display: flex; align-items: center; gap: 4px; }
.tcui-cm-foot kbd { font: 10px var(--tcui-mono); padding: 0 4px; border-radius: 4px; background: var(--tcui-raised); border: 1px solid var(--tcui-border); color: var(--tcui-text-2); box-shadow: none; }
.tcui-cm-overlay.is-contained .tcui-cm-list { max-height: 220px; }

/* spring-select.css */
.tcui-ss { position: relative; width: 100%; font-family: var(--tcui-font); }
.tcui-ss .tcui-ss-label { display: block; margin: 0 0 6px; padding: 0; font-size: 12px; line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; color: var(--tcui-text); user-select: none; }
.tcui-ss-trigger { position: relative; width: 100%; height: 40px; padding: 0 36px 0 14px; display: flex; align-items: center; justify-content: space-between; text-align: left; font: 12px/1.3 var(--tcui-font); border-radius: 8px; border: 1px solid var(--tcui-border); background: var(--tcui-raised); color: var(--tcui-text-2); outline: none; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.tcui-ss-trigger.has-value { color: var(--tcui-text); }
.tcui-ss-trigger:hover, .tcui-ss.is-open .tcui-ss-trigger { border-color: var(--tcui-border-strong); }
.tcui-ss.has-error .tcui-ss-trigger { border-color: color-mix(in srgb, #f43f5e 50%, transparent); }
.tcui-ss.has-error .tcui-ss-trigger:hover { border-color: color-mix(in srgb, #f43f5e 70%, transparent); }
.tcui-ss.is-open.has-error .tcui-ss-trigger { border-color: var(--tcui-border-strong); }
.tcui-ss-trigger:disabled { opacity: 0.3; cursor: not-allowed; }
.tcui-ss-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcui-ss-chev { position: absolute; right: 12px; top: 50%; margin-top: -7px; width: 14px; height: 14px; display: flex; color: var(--tcui-text-2); will-change: transform; }
.tcui-ss-list { position: absolute; z-index: 50; left: 0; right: 0; margin: 6px 0 0; padding: 4px 0; max-height: 240px; overflow: auto; list-style: none; border-radius: 8px; border: 1px solid var(--tcui-border); background: var(--tcui-surface); box-shadow: var(--tcui-shadow-lg); transform-origin: top center; outline: none; }
.tcui-ss-opt { position: relative; margin: 0 4px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-radius: 6px; font-size: 12px; color: var(--tcui-text-2); cursor: pointer; }
.tcui-ss-opt[aria-selected="true"] { color: var(--tcui-text); }
.tcui-ss-opt.is-active { background: var(--tcui-raised); }
.tcui-ss-opt[aria-disabled="true"] { opacity: 0.3; cursor: not-allowed; background: transparent; }
.tcui-ss-opt-text { display: flex; flex-direction: column; }
.tcui-ss-opt-label { line-height: 1.25; }
.tcui-ss-opt-desc { margin-top: 2px; font-size: 10px; color: var(--tcui-text-2); opacity: 0.8; }
.tcui-ss-check { display: flex; color: var(--tcui-text); flex: none; }
.tcui-ss-error { margin: 6px 0 0; font-size: 11px; font-weight: 500; color: #f43f5e; }

/* stat-card.css */
.tcui-st-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
@media (min-width: 640px) { .tcui-st-grid { gap: 16px; } }
.tcui-st { position: relative; min-width: 0; user-select: none; overflow: hidden; border-radius: 16px; background: var(--tcui-surface); padding-top: 16px; color: var(--tcui-text-2); outline: none; box-shadow: 0 0 0 1px var(--tcui-border), 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 36px -28px rgba(0, 0, 0, 0.2); transition: box-shadow 0.2s; touch-action: pan-y; }
@media (hover: hover) { .tcui-st:hover { box-shadow: 0 0 0 1px var(--tcui-border-strong), 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 36px -28px rgba(0, 0, 0, 0.2); } }
.tcui-st:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--tcui-ring); }
.tcui-st p { margin: 0; }
.tcui-st-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 16px; }
.tcui-st-label { font-size: 12.5px; color: var(--tcui-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcui-st-pill { display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; border-radius: 9999px; padding: 2px 8px; font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tcui-st-pill.is-flat { background: rgba(127, 127, 127, 0.1); color: var(--tcui-text-2); }
.tcui-st-pill.is-good { background: rgba(16, 185, 129, 0.1); color: #059669; }
.tcui-st-pill.is-bad { background: rgba(244, 63, 94, 0.1); color: #e11d48; }
.dark .tcui-st-pill.is-good { color: #34d399; }
.dark .tcui-st-pill.is-bad { color: #fb7185; }
.tcui-st-value { margin-top: 6px !important; padding: 0 16px; font-size: 28px; font-weight: 600; line-height: 1; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; color: var(--tcui-text); }
@media (min-width: 640px) { .tcui-st-value { font-size: 30px; } }
.tcui-st-sub { margin-top: 6px !important; padding: 0 16px; font-size: 12px; color: var(--tcui-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcui-st-box { margin-top: 12px; height: 52px; }
.tcui-st-svg { display: block; overflow: visible; }
.tcui-st-latest, .tcui-st-scrub { transition: opacity 0.15s; }
.tcui-st-scrub { opacity: 0; transition-duration: 0.12s; }
.tcui-st-cline { stroke: var(--tcui-border-strong); }
.tcui-st-cdot { stroke: var(--tcui-surface); }
.tcui-st-pulse { transform-box: fill-box; transform-origin: center; animation: tcui-st-pulse 1.8s ease-out infinite; }
@keyframes tcui-st-pulse { from { transform: scale(1); opacity: 0.4; } to { transform: scale(2.8); opacity: 0; } }

