:root {
    /* TDesign-inspired global tokens */
    --td-brand-color: #0052d9;
    --td-brand-color-hover: #366ef4;
    --td-brand-color-active: #003cab;
    --td-brand-color-light: #ecf2fe;
    --td-brand-color-focus: rgba(0, 82, 217, 0.18);
    --td-success-color: #2ba471;
    --td-success-color-light: #e8f8f2;
    --td-warning-color: #ed7b2f;
    --td-warning-color-light: #fff1e9;
    --td-error-color: #d54941;
    --td-error-color-light: #fff0ed;
    --td-text-color-primary: rgba(0, 0, 0, 0.9);
    --td-text-color-secondary: rgba(0, 0, 0, 0.6);
    --td-text-color-placeholder: rgba(0, 0, 0, 0.4);
    --td-bg-color-page: #f3f3f3;
    --td-bg-color-container: #ffffff;
    --td-bg-color-container-hover: #f3f3f3;
    --td-bg-color-secondarycontainer: #f5f5f5;
    --td-component-border: #dcdcdc;
    --td-component-divider: #e7e7e7;
    --td-radius-small: 3px;
    --td-radius-default: 6px;
    --td-radius-large: 9px;
    --td-shadow-1: 0 1px 10px rgba(0, 0, 0, 0.05);
    --td-shadow-2: 0 8px 24px rgba(0, 0, 0, 0.12);
    --td-spacer-1: 8px;
    --td-spacer-2: 16px;
    --td-spacer-3: 24px;
    --td-spacer-4: 32px;
    --td-shell-width: 1440px;
    --td-sidebar-width: 232px;
    --td-header-height: 64px;
    --td-font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Semantic aliases retained for application components */
    --color-bg: var(--td-bg-color-page);
    --color-surface: var(--td-bg-color-container);
    --color-surface-soft: var(--td-bg-color-secondarycontainer);
    --color-text: var(--td-text-color-primary);
    --color-muted: var(--td-text-color-secondary);
    --color-border: var(--td-component-divider);
    --color-primary: var(--td-brand-color);
    --color-primary-hover: var(--td-brand-color-hover);
    --color-primary-soft: var(--td-brand-color-light);
    --color-warning: var(--td-warning-color);
    --color-warning-soft: var(--td-warning-color-light);
    --color-danger: var(--td-error-color);
    --color-danger-soft: var(--td-error-color-light);
    --shadow-panel: var(--td-shadow-1);
    --radius-sm: var(--td-radius-small);
    --radius-md: var(--td-radius-default);
    --radius-lg: var(--td-radius-large);
    --space-1: var(--td-spacer-1);
    --space-2: var(--td-spacer-2);
    --space-3: var(--td-spacer-3);
    --space-4: var(--td-spacer-4);
    --shell: var(--td-shell-width);
    --font: var(--td-font-family);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--td-brand-color-focus); outline-offset: 2px; }
.skip-link { position: fixed; z-index: 200; top: 8px; left: 8px; transform: translateY(-160%); border-radius: var(--radius-sm); padding: 10px 14px; background: #fff; color: var(--color-primary); box-shadow: var(--td-shadow-2); font-weight: 600; text-decoration: none; }
.skip-link:focus { transform: translateY(0); }
.td-icon { display: inline-block; width: 1.25em; height: 1.25em; flex: 0 0 auto; overflow: visible; color: currentColor; vertical-align: -0.2em; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; clip-path: inset(50%) !important; }
.muted { color: var(--color-muted); }

/* Application frame */
.app-layout { min-height: 100vh; }
.app-sidebar { position: sticky; z-index: 40; top: 0; display: flex; min-width: 0; height: var(--td-header-height); align-items: center; gap: 8px; border-bottom: 1px solid var(--color-border); padding: 0 12px; background: var(--color-surface); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02); }
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: var(--radius-default); background: var(--color-primary); color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -0.03em; }
.brand-mark.is-inverse { border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.14); }
.brand-copy { display: none; min-width: 0; }
.brand strong, .brand small, .auth-brand strong, .auth-brand small, .login-brand strong, .login-brand small { display: block; }
.brand strong { overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.brand small { color: var(--color-muted); font-size: 11px; }
.side-nav { display: flex; min-width: 0; align-items: center; gap: 4px; margin-left: auto; }
.side-nav-item { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: var(--radius-default); padding: 0 12px; background: transparent; color: var(--color-muted); font-weight: 500; line-height: 1; text-decoration: none; transition: background-color 150ms ease, color 150ms ease; }
.side-nav-item span { display: none; white-space: nowrap; }
.side-nav-item:hover { background: var(--td-bg-color-container-hover); color: var(--color-text); }
.side-nav-item.is-active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
.side-footer { display: flex; align-items: center; gap: 4px; }
.app-frame { min-width: 0; }
.app-header { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--color-border); padding: 0 16px; background: var(--color-surface); }
.breadcrumb { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--color-muted); font-size: 13px; }
.breadcrumb b { color: var(--td-text-color-placeholder); font-weight: 400; }
.breadcrumb strong { overflow: hidden; color: var(--color-text); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.signed-user { display: inline-flex; min-width: 0; align-items: center; gap: 8px; color: var(--color-muted); font-size: 13px; }
.signed-user > span:last-child { display: none; overflow: hidden; max-width: 160px; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; font-weight: 600; }
.page-shell { width: min(100%, var(--shell)); margin-inline: auto; padding-inline: 16px; }
.page-stack { display: grid; gap: 16px; padding-block: 20px 32px; }
.page-intro, .toolbox-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-intro h1, .toolbox-heading h1 { margin: 0; font-size: clamp(24px, 5vw, 30px); line-height: 1.3; letter-spacing: -0.02em; }
.page-intro p, .toolbox-heading p, .section-description { margin: 6px 0 0; color: var(--color-muted); }
.page-status, .privacy-chip, .status-tag { display: inline-flex; min-height: 28px; align-items: center; gap: 6px; border-radius: var(--radius-sm); padding: 3px 9px; background: var(--td-success-color-light); color: #13795b; font-size: 12px; font-weight: 500; white-space: nowrap; }

/* Cards and collection */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel { border: 1px solid var(--color-border); border-radius: var(--radius-default); background: var(--color-surface); box-shadow: var(--shadow-panel); }
.collector-panel, .snapshot { padding: 20px; }
.section-heading, .library-header, .dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1, h2 { color: var(--color-text); }
h2 { margin: 3px 0 0; font-size: 20px; line-height: 1.35; letter-spacing: -0.01em; }
.eyebrow { color: var(--color-primary); font-size: 12px; font-weight: 600; line-height: 1.4; }
.support-note { display: none; align-items: center; gap: 6px; color: var(--color-muted); font-size: 12px; }
.section-description { font-size: 13px; }
.collect-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: end; margin-top: 20px; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field-wide, .full { grid-column: 1 / -1; }
.field > span, .field-label, .group-label { color: var(--color-text); font-size: 13px; font-weight: 500; }
.field em { margin-left: 4px; color: var(--color-muted); font-size: 12px; font-style: normal; font-weight: 400; }
.field small, .settings-summary small { color: var(--color-muted); font-size: 12px; }
input, textarea, select { width: 100%; border: 1px solid var(--td-component-border); border-radius: var(--radius-sm); background: #fff; color: var(--color-text); caret-color: var(--color-primary); transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease; }
input, select { min-height: 44px; padding: 0 12px; }
textarea { min-height: 104px; padding: 10px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--td-text-color-placeholder); }
input:hover, textarea:hover, select:hover { border-color: #a6a6a6; }
input:focus, textarea:focus, select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--td-brand-color-focus); outline: 0; }
input:disabled, textarea:disabled, select:disabled, input[readonly], textarea[readonly] { background: var(--color-surface-soft); }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0 16px; font-weight: 500; line-height: 1; white-space: nowrap; transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease; }
.button.primary { background: var(--color-primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.button.primary:active:not(:disabled) { background: var(--td-brand-color-active); }
.button.secondary { border-color: var(--td-component-border); background: #fff; color: var(--color-text); }
.button.secondary:hover:not(:disabled), .button.ghost:hover:not(:disabled) { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary); }
.button.ghost { border-color: transparent; background: transparent; color: var(--color-text); }
.button.small { min-height: 44px; padding-inline: 12px; font-size: 13px; }
.collect-button { width: 100%; }
.button.is-loading .button-icon { display: none; }
.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%; animation: spin 700ms linear infinite; }
.is-loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-box { margin-top: 16px; border: 1px solid #85d8ba; border-radius: var(--radius-sm); padding: 12px 14px; background: var(--td-success-color-light); color: #13795b; }
.result-box.is-error { border-color: #f7b9b1; background: var(--color-danger-soft); color: var(--color-danger); }
.result-box ul { margin: 8px 0 0; padding-left: 20px; }
.result-reports { display: grid; gap: 4px; margin-top: 8px; color: var(--color-muted); font-size: 12px; }
.result-reports span { display: block; }
.result-reports em { color: var(--color-warning); font-style: normal; }
.snapshot { display: grid; align-content: start; background: linear-gradient(145deg, #f6f9ff 0%, #fff 60%); }
.snapshot-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: var(--radius-default); background: var(--color-primary-soft); color: var(--color-primary); font-size: 18px; }
.status-tag { background: var(--td-success-color-light); }
.total-count { display: grid; margin-top: 20px; }
.total-count strong { color: var(--color-primary); font-size: clamp(38px, 9vw, 52px); font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.total-count span { margin-top: 6px; color: var(--color-muted); }
.platform-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.platform-stat, .badge { display: inline-flex; align-items: center; border-radius: var(--radius-sm); padding: 3px 8px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; font-weight: 500; }
.snapshot p { margin: 20px 0 0; border-top: 1px solid var(--color-border); padding-top: 16px; color: var(--color-muted); font-size: 12px; }

/* Product library */
.library { overflow: hidden; }
.library-header { align-items: flex-start; flex-direction: column; padding: 20px; }
.header-actions { display: flex; width: 100%; flex-wrap: wrap; gap: 8px; }
.header-actions .button { flex: 1 1 auto; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: center; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); padding: 12px 16px; background: #fafafa; }
.search-field { position: relative; display: block; }
.search-field .td-icon { position: absolute; z-index: 1; top: 50%; left: 12px; transform: translateY(-50%); color: var(--color-muted); }
.search-field input { padding-left: 38px; }
.selection-count { color: var(--color-muted); font-size: 12px; }
.text-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: var(--radius-sm); padding: 0 10px; background: transparent; font-weight: 500; }
.text-button.danger { color: var(--color-danger); }
.text-button:hover:not(:disabled) { background: var(--color-danger-soft); }
.table-wrap { overflow: visible; }
table, thead, tbody, tr, th, td { display: block; }
table { width: 100%; border-collapse: collapse; }
thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
tbody { display: grid; gap: 12px; padding: 12px; }
tbody tr { position: relative; display: grid; gap: 0; border: 1px solid var(--color-border); border-radius: var(--radius-default); padding: 14px; background: #fff; }
tbody td { min-width: 0; border: 0; padding: 7px 0; }
tbody td[data-label] { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; border-top: 1px solid var(--color-border); }
tbody td[data-label]::before { content: attr(data-label); color: var(--color-muted); font-size: 12px; }
.check-cell { position: absolute; z-index: 2; top: 15px; right: 14px; width: 44px; padding: 0; text-align: right; }
.check-cell input {
    position: relative;
    width: 44px;
    min-height: 44px;
    height: 44px;
    margin: 0;
    border: 0;
    border-radius: var(--radius-sm);
    appearance: none;
    background: transparent;
    cursor: pointer;
}
.check-cell input::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    border: 1px solid #a6a6a6;
    border-radius: 2px;
    background: #fff;
    content: "";
}
.check-cell input:checked::before, .check-cell input:indeterminate::before { border-color: var(--color-primary); background: var(--color-primary); }
.check-cell input:checked::after {
    position: absolute;
    top: 14px;
    left: 17px;
    width: 7px;
    height: 12px;
    transform: rotate(45deg);
    border: solid #fff;
    border-width: 0 2px 2px 0;
    content: "";
}
.check-cell input:indeterminate::after {
    position: absolute;
    top: 21px;
    left: 16px;
    width: 12px;
    border-top: 2px solid #fff;
    content: "";
}
.product-cell { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; padding-right: 42px; }
.product-thumb { display: block; width: 56px; height: 56px; border: 1px solid var(--color-border); border-radius: var(--radius-default); object-fit: cover; background: var(--color-surface-soft); }
.product-placeholder { display: grid; place-items: center; color: var(--color-muted); font-weight: 600; }
.product-copy { min-width: 0; }
.product-title { display: block; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.product-url { display: block; overflow: hidden; margin-top: 3px; color: var(--color-primary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.product-url:hover { text-decoration: underline; }
.subline { display: block; overflow: hidden; margin-top: 3px; color: var(--color-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.price { font-variant-numeric: tabular-nums; font-weight: 600; }
.tag-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-cell { padding-top: 10px; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-button, .icon-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-primary); }
.row-button { gap: 6px; padding: 0 10px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.row-button:hover { background: var(--color-primary-soft); }
.row-button.is-danger { color: var(--color-danger); }
.row-button.is-danger:hover { background: var(--color-danger-soft); }
.empty-state { display: grid !important; min-height: 180px; place-items: center; border: 0; color: var(--color-muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--color-border); padding: 12px 16px; color: var(--color-muted); font-size: 13px; }
.pagination > div { display: flex; gap: 8px; }

/* Native accessible dialogs */
.dialog { width: min(calc(100% - 24px), 680px); max-height: calc(100vh - 24px); overflow: hidden; border: 0; border-radius: var(--radius-default); padding: 0; box-shadow: var(--td-shadow-2); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.56); }
.dialog-card { display: grid; max-height: calc(100vh - 24px); grid-template-rows: auto minmax(0, 1fr) auto; background: #fff; }
.wide-dialog { width: 100%; }
.dialog-header, .dialog-footer { padding: 16px 20px; }
.dialog-header { border-bottom: 1px solid var(--color-border); }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--color-border); }
.dialog-body { overflow-y: auto; padding: 20px; }
.icon-button { width: 44px; height: 44px; color: var(--color-muted); font-size: 20px; }
.icon-button:hover { background: var(--color-surface-soft); color: var(--color-text); }
.form-grid, .two-grid, .three-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.field-group { display: grid; gap: 12px; border-top: 1px solid var(--color-border); padding-top: 16px; }
.settings-summary { display: grid; gap: 5px; border: 1px solid #c5d9fb; border-radius: var(--radius-sm); padding: 14px; background: var(--color-primary-soft); }
.settings-summary strong { overflow-wrap: anywhere; font-size: 13px; }

/* Authentication and installation */
.auth-page { min-height: 100vh; background: #eef3fb; }
.auth-layout { display: grid; min-height: 100vh; }
.auth-showcase, .setup-intro { position: relative; overflow: hidden; padding: 28px 24px; background: linear-gradient(145deg, #003cab 0%, #0052d9 52%, #266fe8 100%); color: #fff; }
.auth-showcase::after, .setup-intro::after { position: absolute; right: -80px; bottom: -120px; width: 280px; height: 280px; border: 46px solid rgba(255, 255, 255, 0.08); border-radius: 50%; content: ""; }
.auth-brand, .login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.auth-brand strong, .login-brand strong { font-size: 15px; font-weight: 600; }
.auth-brand small { color: rgba(255, 255, 255, 0.72); font-size: 11px; }
.login-brand small { color: var(--color-muted); font-size: 11px; }
.auth-showcase-copy { position: relative; z-index: 1; margin-top: 28px; }
.auth-kicker { display: block; color: rgba(255, 255, 255, 0.72); font-size: 11px; font-weight: 600; letter-spacing: 0.13em; }
.auth-showcase .auth-showcase-title { margin: 8px 0 0; color: #fff; font-size: clamp(28px, 5vw, 44px); font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; }
.auth-showcase p, .setup-intro > p { max-width: 500px; margin: 12px 0 0; color: rgba(255, 255, 255, 0.78); }
.auth-capabilities { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.auth-capabilities span { border: 1px solid rgba(255, 255, 255, 0.28); border-radius: var(--radius-sm); padding: 5px 9px; color: rgba(255, 255, 255, 0.9); font-size: 12px; }
.auth-form-area { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(100%, 420px); border: 1px solid var(--color-border); border-radius: var(--radius-large); padding: 28px; background: var(--color-surface); box-shadow: var(--td-shadow-1); }
.login-heading { margin-top: 30px; }
.login-heading h1 { margin: 4px 0 0; font-size: 28px; line-height: 1.3; }
.login-heading p { margin: 6px 0 0; color: var(--color-muted); }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.auth-submit { width: 100%; margin-top: 4px; }
.login-footnote { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px 0 0; color: var(--color-muted); font-size: 12px; text-align: center; }
.setup-shell { display: grid; width: min(100%, 1180px); min-height: 100vh; margin-inline: auto; background: #eef3fb; }
.setup-intro { align-content: center; }
.setup-intro .auth-kicker { position: relative; z-index: 1; margin-top: 28px; }
.setup-intro h1 { position: relative; z-index: 1; margin: 8px 0 0; color: #fff; font-size: clamp(30px, 6vw, 48px); line-height: 1.25; }
.setup-steps { position: relative; z-index: 1; display: grid; gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.setup-steps li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.9); font-weight: 500; }
.setup-steps strong { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 50%; font-size: 11px; }
.setup-card { align-self: center; margin: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-large); padding: 24px; background: var(--color-surface); box-shadow: var(--td-shadow-1); }
.step-badge { border-radius: var(--radius-sm); padding: 4px 8px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; font-weight: 500; }
.setup-form { display: grid; gap: 24px; margin-top: 24px; }
.setup-form fieldset { display: grid; gap: 16px; margin: 0; border: 0; border-top: 1px solid var(--color-border); padding: 20px 0 0; }
.setup-form legend { padding: 0 12px 0 0; color: var(--color-text); font-weight: 600; }
.database-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.database-option { display: grid; min-height: 72px; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; border: 1px solid var(--td-component-border); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; }
.database-option:hover { border-color: var(--color-primary); }
.database-option:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-soft); box-shadow: inset 3px 0 0 var(--color-primary); }
.database-option input { width: 18px; min-height: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--color-primary); }
.database-option strong, .database-option small { display: block; }
.database-option small { margin-top: 2px; color: var(--color-muted); font-size: 11px; }
.mysql-fields { display: grid; gap: 14px; border-radius: var(--radius-default); padding: 16px; background: var(--color-surface-soft); }
.setup-submit { width: 100%; }

/* Toolbox */
.toolbox-page { display: grid; gap: 20px; padding-block: 20px 32px; }
.tools-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tool-card { overflow: hidden; }
.tool-header { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; border-bottom: 1px solid var(--color-border); padding: 18px 20px; background: #fafafa; }
.tool-header h2 { margin: 0; font-size: 18px; }
.tool-header p { margin: 4px 0 0; color: var(--color-muted); font-size: 12px; }
.tool-index { display: grid; width: 40px; height: 40px; place-items: center; border-radius: var(--radius-default); background: var(--color-primary-soft); color: var(--color-primary); font-size: 18px; }
.tool-body { display: grid; gap: 16px; padding: 20px; }
.tool-body.two-grid { display: grid; }
.input-with-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.input-with-action input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.inline-button { min-width: 64px; min-height: 44px; border: 1px solid var(--td-component-border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0 12px; background: var(--color-surface-soft); color: var(--color-primary); font-weight: 500; }
.totp-card { border-color: #a6c7f7; }
.totp-output { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: var(--radius-default); padding: 18px; background: #1d2633; color: #fff; }
.totp-output span, .totp-output small { display: block; color: rgba(255, 255, 255, 0.62); font-size: 11px; }
.totp-output strong { display: block; margin-top: 4px; font-size: clamp(27px, 8vw, 38px); font-variant-numeric: tabular-nums; letter-spacing: 0.09em; line-height: 1; }
.totp-timer { min-width: 58px; text-align: center; }
.totp-timer span { color: #fff; font-size: 22px; font-weight: 600; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-error { margin: 0; border: 1px solid #f7b9b1; border-radius: var(--radius-sm); padding: 10px 12px; background: var(--color-danger-soft); color: var(--color-danger); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.metric-grid > div { min-width: 0; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px; background: var(--color-surface-soft); }
.metric-grid span, .text-meta { color: var(--color-muted); font-size: 11px; }
.metric-grid strong { display: block; overflow: hidden; margin-top: 4px; font-size: 18px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; }
.metric-grid strong.negative { color: var(--color-danger); }
.tool-column { display: grid; gap: 8px; }
.text-meta { display: flex; justify-content: space-between; gap: 12px; }
.toast { position: fixed; z-index: 100; right: 12px; bottom: 12px; left: 12px; transform: translateY(24px); border-radius: var(--radius-sm); padding: 12px 16px; background: #1d2633; color: #fff; box-shadow: var(--td-shadow-2); opacity: 0; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast.is-error { background: var(--color-danger); }

@media (min-width: 480px) {
    .brand-copy { display: block; }
    .signed-user > span:last-child { display: block; }
    .page-shell { padding-inline: 24px; }
    .collector-panel, .snapshot { padding: 24px; }
    .form-grid, .two-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .three-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .database-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toast { right: 24px; bottom: 24px; left: auto; width: min(360px, calc(100% - 48px)); }
}
@media (min-width: 720px) {
    .side-nav-item span { display: inline; }
    .collect-form { grid-template-columns: minmax(0, 1fr) 160px 160px; }
    .field-wide { grid-column: 1 / -1; }
    .collect-button { width: auto; min-width: 148px; }
    .support-note { display: inline-flex; }
    .library-header { align-items: center; flex-direction: row; }
    .header-actions { width: auto; }
    .header-actions .button { flex: 0 0 auto; }
    .toolbar { grid-template-columns: minmax(240px, 1fr) 180px auto auto; }
    .selection-count { justify-self: end; }
    .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .metric-grid.three-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
    .auth-layout { grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr); }
    .auth-showcase { display: grid; min-height: 100vh; align-content: space-between; padding: 48px clamp(40px, 6vw, 88px); }
    .auth-showcase-copy { align-self: center; margin: 0; }
    .auth-capabilities { margin-top: auto; }
    .login-card { border-color: transparent; box-shadow: none; }
    .setup-shell { grid-template-columns: minmax(340px, 0.78fr) minmax(520px, 1.22fr); align-items: stretch; padding: 32px; }
    .setup-intro { display: grid; align-content: center; border-radius: var(--radius-large) 0 0 var(--radius-large); padding: 48px; }
    .setup-card { width: 100%; max-width: 680px; margin: auto 0; border-radius: 0 var(--radius-large) var(--radius-large) 0; padding: 36px; }
    .wide-tool { grid-column: 1 / -1; }
}
@media (min-width: 900px) and (max-width: 1023px) {
    .hero-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .collector-panel { grid-column: span 8; }
    .snapshot { grid-column: span 4; }
    .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .app-layout { display: grid; grid-template-columns: var(--td-sidebar-width) minmax(0, 1fr); }
    .app-sidebar { position: fixed; inset: 0 auto 0 0; display: grid; width: var(--td-sidebar-width); height: 100vh; grid-template-rows: var(--td-header-height) minmax(0, 1fr) auto; align-items: stretch; gap: 0; border-right: 1px solid var(--color-border); border-bottom: 0; padding: 0; }
    .brand { padding: 0 20px; }
    .side-nav { display: grid; align-content: start; gap: 4px; margin: 0; padding: 16px 12px; }
    .side-nav-item { width: 100%; justify-content: flex-start; }
    .side-footer { display: grid; gap: 4px; border-top: 1px solid var(--color-border); padding: 12px; }
    .app-frame { grid-column: 2; }
    .app-header { position: sticky; z-index: 30; top: 0; min-height: var(--td-header-height); padding-inline: 24px; }
    .page-stack, .toolbox-page { padding-block: 24px 40px; }
}
@media (min-width: 1280px) {
    .hero-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .collector-panel { grid-column: span 8; }
    .snapshot { grid-column: span 4; }
    .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .table-wrap { overflow-x: auto; }
    table { display: table; min-width: 960px; }
    thead { position: static; display: table-header-group; width: auto; height: auto; overflow: visible; clip-path: none; }
    tbody { display: table-row-group; padding: 0; }
    tr { display: table-row; }
    th, td, tbody td, tbody td[data-label] { display: table-cell; border-bottom: 1px solid var(--color-border); padding: 13px 12px; text-align: left; vertical-align: middle; }
    th { background: #fafafa; color: var(--color-muted); font-size: 12px; font-weight: 500; }
    tbody tr { display: table-row; border: 0; border-radius: 0; padding: 0; }
    tbody tr:hover { background: #fafafa; }
    tbody td[data-label]::before { content: none; }
    .check-cell { position: static; width: 52px; padding-left: 20px; text-align: left; }
    .action-cell { width: 160px; padding-right: 20px; text-align: right; }
    .product-cell { grid-template-columns: 48px minmax(180px, 1fr); padding-right: 0; }
    .product-thumb { width: 48px; height: 48px; }
    .tag-preview { max-width: 210px; }
    .row-actions { justify-content: flex-end; }
    .empty-state { display: table-cell !important; height: 180px; border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
