/* 通用组件层：按钮、表格、标签、弹窗、表单等可复用样式 */

input, select, textarea { width: 100%; padding: 10px 12px; margin-bottom: 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3); color: #fff; font-size: 14px; }

button { padding: 9px 18px; border: none; border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; cursor: pointer; }

button:hover { background: var(--accent-hover); }

button:disabled { opacity: .5; cursor: not-allowed; }

button.danger { background: #d4380d; }

button.ghost { background: rgba(255,255,255,.12); }

.error { color: #ff7875; font-size: 13px; margin-bottom: 10px; min-height: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,.07); }

th { color: #8a8aa5; font-weight: 500; }

pre.result { background: rgba(0,0,0,.4); padding: 10px; border-radius: 6px; font-size: 12px; max-width: 480px; overflow: auto; white-space: pre-wrap; }

pre.result-wide { max-width: none; margin: 4px 0 8px; }

.android-desktop-surface { width:100%; height:min(72vh,780px); min-height:520px; background:#000; border-radius:10px; display:flex; align-items:center; justify-content:center; overflow:hidden; }

.android-desktop-surface:fullscreen { height:100vh; min-height:0; border-radius:0; }

.android-desktop-surface canvas { display:block; max-width:100%; max-height:100%; width:auto; height:auto; touch-action:none; }

.android-desktop-stats { display:flex; gap:16px; flex-wrap:wrap; margin-top:10px; color:var(--text-2); font-size:12px; }

a.link { color: #85a5ff; cursor: pointer; text-decoration: none; }

a.link:hover { text-decoration: underline; }

[data-theme="thu-purple"] { --accent:#6b4fbb; --accent-hover:#8268d4; --bg-grad: linear-gradient(135deg,#1e1a2e 0%,#241d3d 50%,#2e2150 100%); }

[data-theme="china-red"] { --accent:#e60023; --accent-hover:#ff2949; --bg-grad: linear-gradient(135deg,#2e1a1a 0%,#3d1d1d 50%,#461f1f 100%); }

[data-theme="olive-green"] { --accent:#808000; --accent-hover:#99991a; --bg-grad: linear-gradient(135deg,#23231a 0%,#2e2e1d 50%,#34341f 100%); }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #52c41a; animation: pulse 1.5s infinite; margin-right: 6px; }

.chart { width: 100%; height: 72px; margin-top: 8px; display: block; }

/* 资源曲线悬停提示：显示该位置的数据点采集时间与数值 */
.asset-chart-wrap { position: relative; }

.core-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 150px)); gap: 6px; margin-top: 8px; justify-content: start; }

.core-cell { background: rgba(0,0,0,.3); border-radius: 6px; padding: 6px 8px 4px; min-width:0; }

.core-cell .cl { font-size: 10px; color: #777; display: flex; justify-content: space-between; }

.core-cell .cv { color: #ddd; }

.core-cell canvas { width: 100%; height: 26px; display: block; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }

.modal { background: #16213e; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 26px; width: 380px; }

.modal h3 { margin-bottom: 16px; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #aaa; margin-bottom: 14px; }

.check-row input { width: auto; margin: 0; }

/* v1.0 console shell — aligned with the original product demo */
:root, [data-theme="starry-blue"] {
  --accent:#4f7cff; --accent-hover:#6b91ff; --accent-soft:rgba(79,124,255,.14);
  --bg-grad:#090e19; --nav-bg:#080c15; --canvas:#0b1120; --surface:#111a2c;
  --surface-2:#151f34; --line:rgba(148,163,184,.16); --line-strong:rgba(148,163,184,.26);
  --text:#edf2ff; --text-2:#a8b3ca; --text-3:#68758f; --success:#3dd598; --warning:#f5b942; --danger:#ff6b72;
}

[data-theme="thu-purple"] { --accent:#8b6cff; --accent-hover:#a187ff; --accent-soft:rgba(139,108,255,.14); --bg-grad:#0e0a18; --nav-bg:#0b0813; --canvas:#100b1b; --surface:#191226; --surface-2:#211832; }

[data-theme="china-red"] { --accent:#ef4056; --accent-hover:#ff5b6e; --accent-soft:rgba(239,64,86,.14); --bg-grad:#160b0e; --nav-bg:#10070a; --canvas:#180c10; --surface:#241217; --surface-2:#30171e; }

[data-theme="olive-green"] { --accent:#8da33b; --accent-hover:#a2b94e; --accent-soft:rgba(141,163,59,.14); --bg-grad:#101309; --nav-bg:#0b0e07; --canvas:#12160b; --surface:#1b2111; --surface-2:#242c16; }

button, input, select, textarea { font-family:inherit; }

button { min-height:34px; border:1px solid transparent; border-radius:8px; font-weight:600; transition:.18s ease; box-shadow:0 5px 16px rgba(0,0,0,.12); }

button:hover { transform:translateY(-1px); }

button.ghost { background:var(--surface-2); border-color:var(--line); color:var(--text-2); box-shadow:none; }

button.ghost:hover { color:var(--text); border-color:var(--line-strong); background:color-mix(in srgb, var(--surface-2) 80%, white); }

button.danger { background:#b93b49; }

input, select, textarea { background:#0d1526; border-color:var(--line-strong); border-radius:8px; color:var(--text); outline:none; transition:.18s ease; }

input:focus, select:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }

.nav-section { padding:18px 12px 8px; color:var(--text-3); font-size:10px; font-weight:700; letter-spacing:.14em; white-space:nowrap; }

.nav-icon { flex:0 0 20px; width:20px; text-align:center; color:currentColor; font-size:15px; }

.nav-label { overflow:hidden; }

.nav-count { margin-left:auto; min-width:20px; padding:1px 6px; border-radius:10px; color:#241700; background:var(--warning); text-align:center; font-size:10px; }

.page-identity { min-width:150px; }

.page-identity .eyebrow { color:var(--text-3); font-size:10px; font-weight:700; letter-spacing:.14em; }

.page-identity h2 { margin-top:3px; font-size:18px; letter-spacing:.01em; }

.top-tools { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex:1; }

.global-search { position:relative; width:min(340px,32vw); }

.global-search input { height:38px; margin:0; padding-left:36px; background:rgba(8,13,24,.72); }

.global-search span { position:absolute; left:12px; top:9px; color:var(--text-3); }

.alarm-lamp { position:relative; }

.alarm-lamp.on { color:#ef4444; border-color:rgba(239,68,68,.5); animation:alarmBlink 1s infinite; }

.alarm-lamp .alarm-badge { position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; border-radius:8px; background:#ef4444; color:#fff; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; padding:0 4px; }

.alarm-panel { position:fixed; right:16px; top:64px; width:380px; max-height:60vh; overflow:auto; background:var(--surface,#1e293b); border:1px solid var(--line); border-radius:12px; box-shadow:0 18px 44px rgba(2,6,23,.35); z-index:120; padding:10px; }

.alarm-item { display:flex; align-items:center; gap:10px; padding:10px; border-radius:9px; border:1px solid var(--line); margin-bottom:8px; }

.alarm-item .dot { width:8px; height:8px; border-radius:50%; background:#ef4444; flex:none; }

.alarm-item .meta { flex:1; min-width:0; }

.alarm-item .meta b { display:block; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.alarm-item .meta span { font-size:12px; color:var(--text-2); }

.nav-count.alarm { background:#ef4444; color:#fff; }

.alert-summary-row { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }

.alert-row td { vertical-align:top; }

.tenant { display:flex; align-items:center; gap:10px; padding:4px 10px 4px 5px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }

.tenant-avatar { width:30px; height:30px; display:grid; place-items:center; border-radius:8px; background:var(--accent-soft); color:var(--accent-hover); font-weight:800; }

.tenant-meta strong, .tenant-meta small { display:block; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.tenant-meta strong { color:var(--text); font-size:12px; }

.tenant-meta small { margin-top:2px; color:var(--text-3); font-size:10px; }

table { border:1px solid var(--line); border-radius:10px; border-collapse:separate; border-spacing:0; overflow:hidden; }

th { padding:11px 12px; background:rgba(255,255,255,.025); color:var(--text-3); font-size:11px; letter-spacing:.04em; }

td { padding:11px 12px; color:var(--text-2); }

/* v1.0.4-e：统一表格滚动容器。表格外层负责横向滚动，表头在容器内吸顶，
   避免长表格在窄屏下把整页撑宽、也避免滚动时表头丢失。 */
.table-scroll { overflow:auto; border-radius:10px; border:1px solid var(--line); max-width:100%; -webkit-overflow-scrolling:touch; }

/* 操作列吸右：横向滚动时始终可见主要动作 */
.table-scroll > table td.row-actions,
.table-scroll > table th.col-actions { position:sticky; right:0; z-index:1; background:var(--surface, #1e293b); box-shadow:-6px 0 8px -6px rgba(0,0,0,.4); }

/* 长文本截断：单元格保持单行省略号，完整内容通过 title 提示 */
.cell-truncate { max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:block; }

.cell-wrap { word-break:break-all; }

table td:first-child { white-space:nowrap; }

tr:last-child td { border-bottom:0; }

tr:hover td { background:rgba(255,255,255,.018); color:var(--text); }

/* v1.0.4-d：设备行勾选态 */
tr.selected td { background:var(--accent-soft); color:var(--text); }

tr.selected:hover td { background:var(--accent-soft); }

td.device-check, th.device-check { width:34px; padding-left:12px; padding-right:0; }

td.device-check input, th.device-check input { width:auto; margin:0; cursor:pointer; }

/* v1.0.4-e：统一状态块（loading/empty/error/retry 四态）。
   四个状态共用同一容器与排版，避免各页面各写一套导致视觉与语义不一致。 */
.state-block { display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:36px 16px;text-align:center;color:var(--text-3);font-size:13px; }

/* v1.0.4-e：键盘可达性。统一 focus-visible 焦点环，仅键盘导航时出现 */
:focus-visible { outline:2px solid var(--accent,#60a5fa); outline-offset:2px; border-radius:4px; }

button:focus:not(:focus-visible), a:focus:not(:focus-visible), input:focus:not(:focus-visible), select:focus:not(:focus-visible), [tabindex]:focus:not(:focus-visible) { outline:none; }

/* 跳到主内容：键盘用户可跳过侧边栏导航 */
.skip-link { position:absolute; left:-9999px; top:0; z-index:9999; padding:10px 16px; background:var(--surface,#1e293b); color:var(--text,#fff); border:1px solid var(--line); border-radius:8px; }

/* v1.0.4-d：批量任务目标条 */
.batch-bar { display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:12px;padding:9px 12px;border:1px solid var(--line);border-radius:8px;background:var(--accent-soft);font-size:13px; }

.modal { background:var(--surface); border-color:var(--line-strong); box-shadow:0 28px 80px rgba(0,0,0,.48); }
