/* ============================================================
   dashboard-samples.css — 系统全览大屏 sample1~4 共享结构样式
   页面通过 :root 令牌换肤，body 类切换布局：
     .layout-docked  三列分栏（sample1 / sample3）
     .layout-float   全屏地图 + 悬浮玻璃面板（sample2 / sample4）
   所有 JS 生成的类（project-item / task-item / risk-item /
   alert-table / pager / dash-veh-* / stats-modal …）在此统一定义。
   ============================================================ */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar, oklch(0.42 0.03 250)); border-radius: 3px; }

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 顶栏 ---------- */
.dashboard-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    z-index: 1000;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 0 22px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow, none);
}

.header-left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.header-accent {
    width: 5px; height: 30px; border-radius: 3px; flex: 0 0 auto;
    background: linear-gradient(180deg, var(--accent), var(--accent-2, var(--accent)));
}
.datetime-display {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: .03em;
    color: var(--header-text);
    white-space: nowrap;
}

.header-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.system-title {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--header-text);
    white-space: nowrap;
    text-shadow: var(--title-glow, none);
}

/* 时间范围：分段单选（radio 隐藏，label 作胶囊） */
.time-range-select { display: flex; align-items: center; gap: 10px; }
.time-range-select > label { font-size: 12px; color: var(--header-muted); }
#timeRangeRadios {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--seg-bg);
    border: 1px solid var(--seg-border);
}
.tr-radio {
    position: relative;
    font-size: 12px;
    color: var(--seg-text);
    padding: 4px 14px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background .2s, color .2s;
}
.tr-radio input { position: absolute; opacity: 0; pointer-events: none; }
.tr-radio:has(input:checked) {
    background: var(--seg-active-bg);
    color: var(--seg-active-text);
    font-weight: 600;
}

.header-right { display: flex; justify-content: flex-end; }
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 13px;
    color: var(--back-text);
    background: var(--back-bg);
    border: 1px solid var(--back-border);
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}
.back-btn:hover { background: var(--back-hover, var(--back-bg)); color: var(--back-text); }

/* ---------- 分栏布局（layout-docked） ---------- */
.layout-docked .dashboard-content {
    position: fixed;
    top: 64px; left: 0; right: 0; bottom: 0;
    padding: 14px;
    overflow: hidden;
}
.layout-docked .dashboard-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr) 400px;
    gap: 14px;
    height: 100%;
}
.layout-docked .dashboard-left,
.layout-docked .dashboard-right {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
}
.layout-docked .dashboard-center { min-width: 0; display: flex; min-height: 0; }
.layout-docked .alert-module { flex: 1 0 auto; }

/* ---------- 悬浮布局（layout-float）：地图铺满，面板悬浮 ---------- */
.layout-float .dashboard-header {
    top: 14px; left: 14px; right: 14px;
    border-radius: 12px;
    border: 1px solid var(--header-border);
    backdrop-filter: var(--surface-backdrop, none);
    -webkit-backdrop-filter: var(--surface-backdrop, none);
    box-shadow: var(--surface-shadow, none);
}
.layout-float .dashboard-center { position: fixed; inset: 0; z-index: 0; }
.layout-float .dashboard-left,
.layout-float .dashboard-right {
    position: fixed;
    top: 94px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    z-index: 500;
}
.layout-float .dashboard-left { left: 14px; width: 332px; }
.layout-float .dashboard-right { right: 14px; width: 392px; }
.layout-float .dashboard-module { flex: 0 0 auto; }

/* 悬浮布局顶部中央：地图开关 chips + 状态 */
.map-chips {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 94px;
    display: flex;
    gap: 8px;
    z-index: 500;
    align-items: center;
}

/* ---------- 模块卡片 ---------- */
.dashboard-module {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius, 12px);
    padding: 14px 16px 14px;
    box-shadow: var(--surface-shadow, none);
    backdrop-filter: var(--surface-backdrop, none);
    -webkit-backdrop-filter: var(--surface-backdrop, none);
}
.module-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--title-color);
    margin-bottom: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--divider);
}
.module-title .dash-veh-tip { font-size: 11px; font-weight: normal; color: var(--text-3); font-family: var(--font-mono); }

/* ---------- 地图（分栏模式沿用原结构） ---------- */
.layout-docked .map-module { flex: 1; padding: 0; overflow: hidden; min-height: 0; }
.cesium-container { width: 100%; height: 100%; position: relative; background: var(--map-fallback, oklch(0.37 0.05 205)); }
#cesiumContainer { width: 100%; height: 100%; }
.layout-float .cesium-container { position: absolute; inset: 0; }

.cesium-status {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--chip-text);
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    padding: 6px 12px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--chip-shadow, none);
}
.cesium-status::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ok);
}
.map-chips .cesium-status { position: static; }

.cesium-btn { position: absolute; top: 12px; left: 12px; z-index: 100; display: flex; gap: 8px; }
.ctrl-btn {
    display: inline-block;
    padding: 7px 14px;
    font-size: 12px;
    color: var(--chip-text);
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--chip-shadow, none);
    transition: background .2s, color .2s;
}
.ctrl-btn:hover { border-color: var(--accent); }
.ctrl-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
    box-shadow: 0 0 20px -4px var(--accent);
}

/* ---------- 无人车实时工况 ---------- */
.dash-veh-grid { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
.dash-veh-card {
    border: 1px solid var(--item-border);
    border-left: 3px solid var(--ok);
    border-radius: 9px;
    padding: 9px 11px;
    background: var(--item-bg);
    cursor: pointer;
    transition: border-color .2s;
}
.dash-veh-card:hover { border-color: var(--accent); }
.dash-veh-card.offline { border-left-color: var(--text-3); opacity: .72; }
.dash-veh-card .vid {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--title-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}
.dash-veh-card .badge {
    font-size: 10px;
    font-family: inherit;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--ok-contrast);
    background: var(--ok);
}
.dash-veh-card.offline .badge { background: var(--text-3); color: var(--surface); }
.dash-veh-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.dash-veh-metrics .m {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--divider);
}
.dash-veh-metrics .m:nth-last-child(-n+2) { border-bottom: none; }
.dash-veh-metrics .m .k { color: var(--text-3); font-size: 11px; }
.dash-veh-metrics .m .v { color: var(--text); font-weight: 600; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dash-veh-foot {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed var(--divider);
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-3);
    display: flex;
    justify-content: space-between;
}
.dash-veh-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 工程管理 ---------- */
.stats-btn {
    background: var(--accent);
    color: var(--accent-contrast);
    border: none;
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.stats-btn:hover { filter: brightness(1.1); }

.project-list { overflow: visible; }
.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--item-bg);
    border: 1px solid var(--item-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.project-item:hover { border-color: var(--accent); }
.project-item.selected {
    border-color: var(--accent);
    background: var(--item-selected-bg);
    box-shadow: inset 3px 0 0 var(--accent);
}
.project-item.all-projects { justify-content: flex-start; font-weight: 600; }
.project-item.all-projects .project-name { color: var(--accent); }
.project-name { flex: 1; color: var(--text); font-size: 13px; font-weight: 500; }
.project-item.selected .project-name { color: var(--title-color); font-weight: 600; }
.project-stats { display: flex; gap: 15px; font-size: 12px; }
.project-stat-item { display: flex; flex-direction: column; align-items: center; }
.project-stat-label { color: var(--text-3); font-size: 10px; margin-bottom: 2px; }
.project-stat-value { color: var(--text); font-weight: 600; font-size: 15px; font-family: var(--font-mono); }
.project-stat-value.danger { color: var(--danger); }
.project-stat-value.warning { color: var(--warn); }

/* ---------- 关联任务 ---------- */
.task-list { overflow: visible; }
.task-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--item-bg);
    border: 1px solid var(--item-border);
    border-radius: 8px;
}
.task-item .task-name { font-size: 13px; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.task-item .task-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-3); }
.task-badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.task-badge.pending { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.task-badge.progress { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }
.task-badge.done { background: color-mix(in oklab, var(--ok) 18%, transparent); color: var(--ok); }
.task-badge.cancel { background: color-mix(in oklab, var(--text-3) 18%, transparent); color: var(--text-3); }
.task-item .task-ops { display: flex; gap: 8px; margin-top: 8px; }
.task-item .task-ops a {
    flex: 1;
    text-align: center;
    font-size: 11px;
    padding: 4px 0;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    color: var(--accent);
    border: 1px solid var(--btn-outline, var(--accent));
    background: transparent;
    transition: background .2s, color .2s;
}
.task-item .task-ops a:hover { background: var(--accent); color: var(--accent-contrast); }
.task-item.task-active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- 疑似险情列表 ---------- */
.risk-list { overflow: visible; }
.risk-item {
    display: flex;
    align-items: center;
    padding: 11px 12px;
    margin-bottom: 6px;
    background: var(--item-bg);
    border: 1px solid var(--item-border);
    border-radius: 10px;
    box-shadow: inset 3px 0 0 var(--warn);
    cursor: pointer;
    transition: border-color .2s;
}
.risk-item:hover { border-color: var(--warn); }
.risk-item.active { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.risk-number {
    width: 20px; height: 20px;
    line-height: 20px;
    text-align: center;
    background: var(--warn);
    border-radius: 50%;
    color: var(--warn-contrast);
    font-weight: 600;
    font-size: 11px;
    font-family: var(--font-mono);
    margin-right: 11px;
    flex-shrink: 0;
}
.risk-item.active .risk-number { background: var(--danger); color: var(--danger-contrast); }
.risk-content { flex: 1; min-width: 0; }
.risk-project-name { color: var(--text); font-size: 13px; line-height: 1.5; margin-bottom: 5px; }
.risk-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; font-family: var(--font-mono); color: var(--text-3); }
.risk-count { color: var(--warn); font-weight: 600; }
.risk-link {
    flex-shrink: 0;
    margin-left: 10px;
    padding: 5px 11px;
    font-size: 11px;
    line-height: 1;
    color: var(--accent);
    border: 1px solid var(--btn-outline, var(--accent));
    border-radius: 6px;
    background: transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s, color .2s;
}
.risk-link:hover { color: var(--accent-contrast); background: var(--accent); }

/* ---------- 疑似险情台账 ---------- */
.alert-table-container { overflow: visible; }
.alert-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.alert-table thead { position: sticky; top: 0; z-index: 10; }
.alert-table th {
    padding: 8px;
    text-align: left;
    color: var(--thead-text, var(--text-2));
    font-weight: 600;
    font-size: 11px;
    background: var(--thead-bg);
    white-space: nowrap;
}
.alert-table th:first-child { border-radius: 7px 0 0 7px; }
.alert-table th:last-child { border-radius: 0 7px 7px 0; }
.alert-table td {
    padding: 10px 8px;
    color: var(--text);
    border-bottom: 1px solid var(--divider);
    line-height: 1.5;
    vertical-align: top;
}
.alert-table td span[style*="font-size: 11px"] { font-family: var(--font-mono); }
.alert-table tbody tr { transition: background .2s; }
.alert-table tbody tr:hover { background: var(--item-bg); cursor: pointer; }
.alert-table tbody tr[data-id] { cursor: pointer; }
.alert-table tbody tr.alert-row-selected { background: var(--item-selected-bg); box-shadow: inset 3px 0 0 var(--accent); }
.alert-filter-note td { background: var(--note-bg) !important; color: var(--accent); font-size: 11px; padding: 6px 10px; }
.alert-filter-note a { color: var(--accent); text-decoration: underline; }

.alert-status {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}
.alert-status.pending { background: var(--warn); color: var(--warn-contrast); }
.alert-status.processing { background: color-mix(in oklab, var(--accent) 20%, transparent); color: var(--accent); border: 1px solid var(--accent); }
.alert-status.resolved { background: color-mix(in oklab, var(--ok) 20%, transparent); color: var(--ok); border: 1px solid var(--ok); }

/* ---------- 翻页条 ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px 0; }
.pg-btn {
    background: var(--item-bg);
    border: 1px solid var(--item-border);
    border-radius: 6px;
    padding: 4px 11px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-2);
    transition: background .2s, color .2s;
}
.pg-btn:hover:not(:disabled) { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-info { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); }

/* ---------- 疑似险情统计弹窗（保持浅色面板，图表文字为深色） ---------- */
.stats-modal { position: fixed; inset: 0; z-index: 20000; }
.stats-modal-mask { position: absolute; inset: 0; background: rgba(4, 10, 22, .55); backdrop-filter: blur(3px); }
.stats-modal-box {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 460px;
    max-width: 92vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5);
    overflow: hidden;
}
.stats-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
.stats-modal-close { cursor: pointer; color: #999; font-size: 16px; }
.stats-modal-close:hover { color: #333; }

/* Cesium 版权栏隐藏 */
.cesium-widget-credits, .cesium-viewer-bottom, .cesium-credit-lightbox { display: none !important; }

/* Cesium 自带工具条（home / 2D3D 切换）：避开状态 chip 与悬浮顶栏/右栏 */
.layout-docked .cesium-viewer-toolbar { top: 52px; right: 12px; }
.layout-float .cesium-viewer-toolbar { top: 94px; right: 420px; }

/* 空态：统一基础样式（JS 渲染 .list-empty） */
.list-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 12px;
    color: var(--text-3);
    font-size: 13px;
}

/* 空态提示统一颜色（JS 内联写死 #999，用属性覆盖） */
.project-list div[style*="color:#999"],
.task-list div[style*="color:#999"],
.risk-list div[style*="color:#999"],
.alert-table td[style*="color:#999"] { color: var(--text-3) !important; }
.alert-table td span[style*="color: #999"] { color: var(--text-3) !important; }
