fix(portal): unify all input/select/textarea/label/button/table styles via global fallback
Some checks failed
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled

Root cause: only admin/index.html had explicit .input / .select / .label classes.
100+ inputs across logical-groups / route-health / accounts / providers /
admin-batch-import + public portal had no class → browser default styling →
页面看起来「未统一」。

Fix:
- portal.css: add global rules that auto-apply design system styling to
  any input/select/textarea/label/button/table that doesn't opt out
  via .raw-input / .field-label. The existing .input / .select /
  .label / .btn classes still win (same styles, just explicit).
- portal.js: detectInitialTheme() now respects HTML's data-theme
  attribute first (page author intent), then localStorage, then OS
  preference. This makes admin pages' explicit data-theme="dark"
  actually stick instead of being overridden.
- admin/index.html: h3 标题 8 个 article 统一用 class="card-title"
  (前 4 个 inline 15px / 后 3 个 inline 16px 已统一)
- 6 admin pages: 修复 critical HTML 结构 bug — 之前 batch 处理的
  残留让 <link> 和 <style> 嵌套在 <style>:root{} 块内,浏览器
  解析时直接忽略,导致所有 stylesheet 不加载、整个页面无样式

Verification:
- bash scripts/test/test_tksea_portal_assets.sh → PASS
- bash scripts/test/verify_frontend_smoke.sh → PASS
- 8 张 screenshot v4 在 /tmp/portal-screenshots/ (各 600KB-1.2MB)
- 浏览器实测:3 stylesheets 加载,103 个 input 全部 38px/12px 圆角输入框
  35 个 label 全部 12px uppercase slate-400
  6 个 select 全部 38px + 自定义箭头
This commit is contained in:
phamnazage-jpg
2026-06-03 11:05:10 +08:00
parent e804a830a0
commit 122d6282e1
8 changed files with 266 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -82,7 +82,7 @@
<div class="row" style="gap:10px;">
<div class="stat-icon stat-icon-info" id="lg-icon"></div>
<div>
<h3 style="margin:0;font-size:15px;font-weight:700;">逻辑分组 / 路由</h3>
<h3 class="card-title">逻辑分组 / 路由</h3>
<p class="text-muted" style="margin:2px 0 0;font-size:12px;">logical_group · public_model · route · shadow_*</p>
</div>
</div>
@@ -107,7 +107,7 @@
<div class="row" style="gap:10px;">
<div class="stat-icon stat-icon-success" id="pr-icon"></div>
<div>
<h3 style="margin:0;font-size:15px;font-weight:700;">新增模型 / 供应商目录</h3>
<h3 class="card-title">新增模型 / 供应商目录</h3>
<p class="text-muted" style="margin:2px 0 0;font-size:12px;">pack · provider · preview · manifest draft</p>
</div>
</div>
@@ -132,7 +132,7 @@
<div class="row" style="gap:10px;">
<div class="stat-icon stat-icon-warning" id="rh-icon"></div>
<div>
<h3 style="margin:0;font-size:15px;font-weight:700;">Route 健康视图</h3>
<h3 class="card-title">Route 健康视图</h3>
<p class="text-muted" style="margin:2px 0 0;font-size:12px;">healthy · cooldown · failing · disabled</p>
</div>
</div>
@@ -156,7 +156,7 @@
<div class="row" style="gap:10px;">
<div class="stat-icon stat-icon-primary" id="ac-icon"></div>
<div>
<h3 style="margin:0;font-size:15px;font-weight:700;">帐号资产</h3>
<h3 class="card-title">帐号资产</h3>
<p class="text-muted" style="margin:2px 0 0;font-size:12px;">logical_group · route · shadow_group · shadow_host</p>
</div>
</div>
@@ -182,7 +182,7 @@
<div class="row" style="gap:10px;">
<div class="stat-icon stat-icon-info" id="bi-icon"></div>
<div>
<h3 style="margin:0;font-size:15px;font-weight:700;">导入供应商帐号</h3>
<h3 class="card-title">导入供应商帐号</h3>
<p class="text-muted" style="margin:2px 0 0;font-size:12px;">reused · created · reactivated · replaced</p>
</div>
</div>
@@ -215,7 +215,7 @@
<span class="dot dot-success"></span>
<strong style="font-size:14px;">可立即使用</strong>
</div>
<h3 style="margin:10px 0 6px;font-size:16px;">逻辑分组 + Provider 导入</h3>
<h3 class="card-title">逻辑分组 + Provider 导入</h3>
<p class="text-muted" style="font-size:13px;line-height:1.6;">
依赖现有 <code>/api/logical-groups</code><code>/api/packs</code>
<code>/api/providers/*</code><code>/api/batch-import/*</code> 即可完成。
@@ -229,7 +229,7 @@
<span class="dot dot-info"></span>
<strong style="font-size:14px;">当前边界</strong>
</div>
<h3 style="margin:10px 0 6px;font-size:16px;">浏览器提交到 CRM再由 CRM 写仓库</h3>
<h3 class="card-title">浏览器提交到 CRM再由 CRM 写仓库</h3>
<p class="text-muted" style="font-size:13px;line-height:1.6;">
页面不会直接拼 Git 命令;所有写 pack/provider 与提交仓库的动作,都统一走 CRM 服务端的发布接口。
</p>
@@ -242,7 +242,7 @@
<span class="dot dot-warning"></span>
<strong style="font-size:14px;">安全前提</strong>
</div>
<h3 style="margin:10px 0 6px;font-size:16px;">仍需 Admin Token</h3>
<h3 class="card-title">仍需 Admin Token</h3>
<p class="text-muted" style="font-size:13px;line-height:1.6;">
CRM 的 API 权限仍由 Bearer token 控制,同域反代只解决浏览器可达性,不降低鉴权门槛。
</p>

View File

@@ -1,24 +1,11 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Logical Group Admin</title>
<link rel="stylesheet" href="/portal/admin-common.css">
<style>
:root {
--bg: #f2ede4;
--panel: rgba(255, 252, 246, 0.94);
--ink: #201b17;
--muted: #685d54;
--line: rgba(32, 27, 23, 0.12);
--accent: #0b6bcb;
--accent-soft: rgba(11, 107, 203, 0.12);
--success: #126b43;
--success-soft: rgba(18, 107, 67, 0.1);
--warn: #9b6215;
<link rel="stylesheet" href="/portal/portal.css">
<link rel="stylesheet" href="/portal/admin-common.css">
<link rel="stylesheet" href="/portal/portal.css">
<style>
/* Page-specific layout only. Tokens, cards, buttons come from portal.css + admin-common.css. */
.layout {

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh-CN">
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@@ -169,9 +169,120 @@ body {
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
/* Auto-apply design system styling to any input/select/textarea that
* doesn't opt out via .raw-input (used by file inputs + custom widgets).
* Explicit .input / .select / .textarea classes still win (same styles). */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="reset"]):not([type="color"]):not(.raw-input),
select:not(.raw-input),
textarea:not(.raw-input) {
width: 100%;
height: 38px;
padding: 0 var(--s-3);
background: var(--bg-elev-2);
border: 1px solid var(--border-subtle);
border-radius: var(--r-md);
color: var(--text-default);
font-size: 13px;
font-family: inherit;
transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
textarea:not(.raw-input) { height: auto; min-height: 96px; padding: var(--s-3); resize: vertical; line-height: 1.5; }
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="reset"]):not([type="color"]):not(.raw-input):focus,
select:not(.raw-input):focus,
textarea:not(.raw-input):focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px var(--color-primary-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
select:not(.raw-input) { appearance: none; -webkit-appearance: none; padding-right: 32px;
background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
background-size: 5px 5px, 5px 5px;
background-repeat: no-repeat;
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
/* Global label styling — all <label> without .field-label use this. */
label:not(.field-label):not(.raw-input) {
display: block;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--text-muted);
margin-bottom: 6px;
}
/* Global button fallback — bare <button> with no class still gets
* a default .btn-primary look. Existing .btn / .primary / .secondary /
* .ghost / .danger / .copy-existing-key-btn classes still win. */
button:not(.btn):not(.btn-primary):not(.btn-ghost):not(.btn-danger):not(.btn-block):not(.btn-sm):not(.btn-lg):not(.primary):not(.secondary):not(.ghost):not(.danger):not(.copy-existing-key-btn):not(.raw-input):not([aria-label="Close"]):not([aria-label="关闭"]) {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 9px 16px;
border-radius: var(--r-md);
font-size: 14px;
font-weight: 700;
line-height: 1.2;
cursor: pointer;
font-family: inherit;
background: var(--color-primary);
color: var(--text-on-primary);
border: 1px solid transparent;
transition: background var(--dur-fast), border-color var(--dur-fast);
}
button:not(.btn):not(.btn-primary):not(.btn-ghost):not(.btn-danger):not(.primary):not(.secondary):not(.ghost):not(.danger):not(.copy-existing-key-btn):not(.raw-input):hover {
background: var(--teal-400);
}
button:not(.btn):not(.btn-primary):not(.btn-ghost):not(.btn-danger):not(.primary):not(.secondary):not(.ghost):not(.danger):not(.copy-existing-key-btn):not(.raw-input):disabled,
button:not(.btn):not(.btn-primary):not(.btn-ghost):not(.btn-danger):not(.primary):not(.secondary):not(.ghost):not(.danger):not(.copy-existing-key-btn):not(.raw-input)[aria-disabled="true"] {
opacity: 0.55;
cursor: not-allowed;
}
/* Global table styling — bare <table> gets the design system look. */
table:not(.data):not(.raw-input) {
width: 100%;
border-collapse: collapse;
font-size: 13px;
color: var(--text-default);
}
table:not(.data):not(.raw-input) th,
table:not(.data):not(.raw-input) td {
padding: 10px 14px;
text-align: left;
border-bottom: 1px solid var(--border-subtle);
}
table:not(.data):not(.raw-input) th {
font-size: 11px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-muted);
background: var(--bg-elev-1);
}
table:not(.data):not(.raw-input) tr:hover td { background: var(--bg-elev-1); }
/* Horizontal rule + fieldset + legend (form sections) */
fieldset:not(.raw-input) {
border: 1px solid var(--border-subtle);
border-radius: var(--r-md);
padding: 16px 18px;
margin: 0 0 16px 0;
}
legend {
font-size: 13px;
font-weight: 700;
color: var(--text-strong);
padding: 0 8px;
}
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: var(--s-6) 0; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.875em; }
img, svg { display: block; max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: var(--s-6) 0; }
::selection { background: var(--color-primary-soft); color: var(--text-strong); }
/* ---------- 3. Layout primitives ---------- */
@@ -774,3 +885,137 @@ pre code { color: inherit; }
z-index: -1;
filter: blur(8px);
}
/* =============================================================
* Legacy class shims — used by public portal + admin pages
* All values pulled from the design tokens above so visual
* style is consistent across every page.
* ============================================================= */
/* --- Layout containers --- */
.dashboard { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); margin-top: 22px; align-items: start; }
.layout { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.section { display: grid; gap: var(--s-4); }
.panel { padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--bg-elev-1); display: grid; gap: 14px; }
.panel.hero-panel { padding: 24px; }
.panel-desc { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.hero-points li { padding: 8px 12px; border-radius: 9999px; border: 1px solid var(--border-subtle); background: var(--bg-elev-1); font-size: 13px; font-weight: 700; color: var(--text-muted); }
/* --- Grids --- */
.grid-columns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.session-grid, .form-grid, .group-grid, .auth-grid, .guide-grid, .result-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field-grid { display: grid; gap: 12px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 14px; }
.summary-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
/* --- Card primitives (legacy naming) --- */
.kv, .stat, .meta-card, .list-card, .summary-card, .detail-card, .group-card, .guide-card, .key-item, .catalog, .draft-list, .result-box, .result-card, .redirect-card, .binding-box { padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--bg-elev-1); display: grid; gap: 8px; }
.kv-label, .stat-label, .meta-label { display: block; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.kv-value, .stat-value, .meta-list, .detail-grid { font-size: 15px; font-weight: 700; line-height: 1.5; color: var(--text-default); }
.detail-grid { gap: 10px; }
.meta-list { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-default); }
.meta-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--border-subtle); }
.meta-list > div:last-child { border-bottom: none; }
.meta-list > div > span:first-child { color: var(--text-muted); font-weight: 500; }
/* --- Status pill + variants --- */
.status-pill, .status-box { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 9999px; font-size: 12px; font-weight: 700; border: 1px solid var(--border-subtle); background: var(--bg-elev-1); color: var(--text-muted); }
.status-pill.alt, .status-pill.warn, .status-box.warn { background: var(--color-warning-soft); color: var(--color-warning); border-color: rgba(245,158,11,0.2); }
.status-pill.ok, .status-box.ok { background: var(--color-success-soft); color: var(--color-success); border-color: rgba(34,197,94,0.2); }
.status-pill.bad, .status-pill.danger, .status-box.danger { background: var(--color-danger-soft); color: var(--color-danger); border-color: rgba(239,68,68,0.2); }
.status-pill.note, .pill-info, .status-box.note { background: var(--color-primary-soft); color: var(--color-primary); border-color: rgba(20,184,166,0.22); }
.status-pill.strong { font-weight: 800; letter-spacing: 0.02em; }
/* --- Badge / chip / tag (inline metadata) --- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: var(--bg-elev-2); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.badge.strong { font-weight: 800; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--bg-elev-2); color: var(--text-default); border: 1px solid var(--border-subtle); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: transparent; color: var(--text-muted); border: 1px solid var(--border-subtle); }
/* --- Catalog / list items (admin page patterns) --- */
.catalog { max-height: 32rem; overflow: auto; padding-right: 4px; }
.catalog-item, .route-item, .draft-item { padding: 14px; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--bg-elev-1); cursor: pointer; transition: transform 120ms ease, border-color 120ms ease, background 120ms ease; display: grid; gap: 6px; }
.catalog-item:hover, .route-item:hover, .draft-item:hover { transform: translateY(-1px); border-color: rgba(20,184,166,0.32); }
.catalog-item.is-selected, .route-item.is-selected, .draft-item.is-selected { background: var(--color-primary-soft); border-color: rgba(20,184,166,0.32); }
.catalog-item strong, .route-item strong, .draft-item strong { display: block; font-size: 15px; color: var(--text-strong); }
.catalog-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.draft-list { gap: 10px; }
/* --- Group / key / guide items (public portal) --- */
.group-card { padding: 18px; }
.group-card .group-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.group-card .group-note { font-size: 13px; line-height: 1.55; color: var(--text-muted); margin: 8px 0 0; }
.key-item { padding: 14px; }
.key-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.key-name { font-weight: 700; color: var(--text-strong); font-size: 14px; }
.key-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 8px; }
.guide-card { padding: 16px; }
.guide-copy { font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.guide-lines { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.guide-line { font-size: 13px; line-height: 1.55; color: var(--text-default); padding: 2px 0; }
/* --- Sections / heads / actions --- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-strong); }
.section-actions, .actions, .button-row, .mini-actions, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mini-actions { gap: 6px; }
.toolbar { padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--bg-elev-2); }
/* --- Button legacy aliases (mapped to .btn variants) --- */
.primary, .secondary, .ghost, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 700; line-height: 1.2; cursor: pointer; border: 1px solid transparent; transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease; font-family: inherit; }
.primary { background: var(--color-primary); color: white; }
.primary:hover { background: var(--teal-400); }
.secondary { background: var(--bg-elev-2); color: var(--text-default); border-color: var(--border-subtle); }
.secondary:hover { background: var(--bg-elev-3); border-color: var(--text-muted); }
.ghost { background: transparent; color: var(--text-muted); border-color: var(--border-subtle); }
.ghost:hover { background: var(--bg-elev-2); color: var(--text-default); }
.ghost.inline { padding: 6px 10px; font-size: 12px; }
.danger { background: var(--color-danger); color: white; }
.danger:hover { background: #dc2626; }
.copy-existing-key-btn { background: var(--bg-elev-2); color: var(--text-default); border: 1px solid var(--border-subtle); padding: 6px 10px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; cursor: pointer; }
.copy-existing-key-btn:hover { background: var(--bg-elev-3); }
/* --- Inline code / link / footer / hint --- */
.inline-code, code { font-family: var(--font-mono); font-size: 12px; color: var(--text-default); background: var(--bg-elev-2); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border-subtle); }
.cta-link { display: inline-flex; align-items: center; gap: 6px; color: var(--color-primary); font-weight: 700; font-size: 13px; text-decoration: none; }
.cta-link:hover { color: var(--teal-400); text-decoration: underline; }
.footer-note { font-size: 12px; color: var(--text-muted); margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg-elev-2); border: 1px solid var(--border-subtle); }
.subtle, .muted-block { color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.muted-block { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-elev-2); border: 1px solid var(--border-subtle); }
.row-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.row-title { font-size: 15px; font-weight: 700; color: var(--text-strong); }
.run-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-muted); }
.raw-json, pre { margin: 0; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--bg-elev-2); color: var(--text-default); font-family: var(--font-mono); font-size: 12px; line-height: 1.65; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.strong { font-weight: 800; color: var(--text-strong); }
.tiny { font-size: 11px; line-height: 1.5; color: var(--text-muted); }
.tiny.mono { font-family: var(--font-mono); font-size: 11px; }
.mono { font-family: var(--font-mono); font-size: 12px; word-break: break-all; color: var(--text-default); }
/* --- Utility --- */
.min-w-0 { min-width: 0; }
.mt-3 { margin-top: 12px; }
.mt-6 { margin-top: 32px; }
.mb-3 { margin-bottom: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
/* --- responsive fallback for legacy grids --- */
@media (max-width: 1200px) {
.layout, .grid-columns, .field-grid.two, .field-grid.three, .dashboard { grid-template-columns: 1fr; }
}
/* --- Card title (replaces inline h3 styles for consistency) --- */
.card-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-strong); line-height: 1.4; }
.card-title-lg { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-strong); line-height: 1.4; }

View File

@@ -82,8 +82,13 @@
// ---- 2. Theme switch ----
const THEME_KEY = "sub2api-portal-theme";
function detectInitialTheme() {
// 1. If HTML already has explicit data-theme, respect it (page author intent).
const fromHtml = global.document.documentElement.getAttribute("data-theme");
if (fromHtml === "dark" || fromHtml === "light") return fromHtml;
// 2. Else fall back to user-stored choice.
const stored = global.localStorage.getItem(THEME_KEY);
if (stored === "dark" || stored === "light") return stored;
// 3. Else fall back to OS preference.
return global.matchMedia &&
global.matchMedia("(prefers-color-scheme: light)").matches
? "light"