/* wireframe prototype */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-alt: #fafafa;
  --border: #d0d0d0;
  --border-light: #e5e5e5;
  --text: #222222;
  --text-sec: #555555;
  --text-muted: #999999;
  --text-light: #bbbbbb;
  --accent: #333333;
  --accent-bg: #f0f0f0;
  --mark: #222222;
  --mark-bg: #e8e8e8;
  --radius: 4px;
  --radius-sm: 3px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 2px 6px rgba(0,0,0,.08);
  --shadow-lg: 0 6px 20px rgba(0,0,0,.12);
  --topbar-h: 48px;
  --side-w: 64px;
  --font: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: var(--font); font-size: 13px; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
input, button, select, textarea { font-family: var(--font); }

/* ---- animations ---- */
.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideOut { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- topbar ---- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 100; background: #333; display: flex; align-items: center; padding: 0 16px; }
.topbar .logo { display: flex; align-items: center; margin-right: 12px; cursor: pointer; }
.topbar .sys { font-size: 13px; font-weight: 600; color: #ccc; border-left: 1px solid #555; padding-left: 12px; }
.topbar .spacer { flex: 1; }
.topbar .tb-search { position: relative; margin-right: 8px; }
.topbar .tb-search input { height: 28px; width: 180px; padding: 0 8px 0 28px; border: 1px solid #555; border-radius: var(--radius); background: #444; font-size: 11px; outline: none; color: #ccc; transition: all .15s; }
.topbar .tb-search input::placeholder { color: #888; }
.topbar .tb-search input:focus { background: #555; border-color: #888; width: 220px; }
.topbar .tb-search .ico { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: #888; pointer-events: none; }
.topbar .tb-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; margin-left: 4px; background: none; border: none; color: #bbb; transition: all .15s; position: relative; }
.topbar .tb-btn:hover { background: #444; color: #fff; }
.topbar .tb-btn .badge { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.topbar .user { display: flex; align-items: center; gap: 6px; margin-left: 10px; cursor: pointer; font-size: 11px; color: #ccc; padding: 3px 6px; border-radius: var(--radius); transition: background .15s; }
.topbar .user:hover { background: #444; }
.topbar .user .av { width: 26px; height: 26px; border-radius: 50%; background: #777; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ---- sidebar ---- */
.sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--side-w); z-index: 90; background: var(--surface); border-right: 1px solid var(--border-light); display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.sidebar a { width: 52px; height: 50px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); font-size: 10px; margin: 1px 0; cursor: pointer; transition: all .15s; }
.sidebar a .ico { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.sidebar a:hover { color: var(--text-sec); background: var(--surface-alt); }
.sidebar a.active { color: var(--text); background: var(--mark-bg); font-weight: 600; }

/* ---- main ---- */
.main { position: absolute; top: var(--topbar-h); left: var(--side-w); right: 0; bottom: 0; overflow: auto; }
.page { padding: 16px 20px; max-width: 1400px; }
.page-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.page-sub { font-size: 11px; color: var(--text-muted); margin-bottom: 14px; }

/* ---- card ---- */
.wf-card { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.wf-card-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

/* ---- buttons ---- */
.wf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; background: var(--surface); font-family: var(--font); white-space: nowrap; transition: all .12s; }
.wf-btn:hover { border-color: var(--text-muted); }
.wf-btn.primary { background: var(--text); color: #fff; border-color: var(--text); }
.wf-btn.primary:hover { background: #000; }
.wf-btn.yellow { background: #eee; color: var(--text); border-color: #ccc; font-weight: 600; }
.wf-btn.yellow:hover { background: #e0e0e0; }
.wf-btn.sm { height: 24px; padding: 0 8px; font-size: 10px; }
.wf-btn.disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ---- inputs ---- */
.wf-input { height: 28px; padding: 0 8px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; width: 100%; transition: border-color .12s; color: var(--text); }
.wf-input:focus { border-color: var(--text); }
.wf-input.error { border-color: #333; background: #f5f5f5; }
.wf-select { height: 28px; padding: 0 8px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.wf-label { font-size: 11px; color: var(--text-sec); margin-bottom: 4px; display: block; }
.wf-field { margin-bottom: 10px; }
.field-err { color: #333; font-size: 10px; margin-top: 2px; animation: fadeIn .2s ease; }

/* ---- tabs ---- */
.wf-tabs { display: flex; border-bottom: 1px solid var(--border-light); margin-bottom: 12px; }
.wf-tabs .tab { padding: 6px 14px; font-size: 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-muted); transition: all .12s; }
.wf-tabs .tab:hover { color: var(--text-sec); }
.wf-tabs .tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.tab-panel { animation: fadeIn .25s ease; }

/* ---- table ---- */
.wf-table { width: 100%; border-collapse: collapse; }
.wf-table th { text-align: left; font-size: 10px; color: var(--text-muted); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--border); background: var(--surface-alt); text-transform: uppercase; letter-spacing: .3px; }
.wf-table td { padding: 8px 8px; font-size: 12px; border-bottom: 1px solid var(--border-light); }
.wf-table tr:hover td { background: var(--surface-alt); }
.wf-table .link { color: var(--text); text-decoration: underline; cursor: pointer; }

/* ---- tags ---- */
.wf-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; font-size: 10px; border-radius: 2px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.wf-tag.red { border-color: #999; color: #333; background: #eee; font-weight: 600; }
.wf-tag.green { border-color: #bbb; color: #555; background: #f5f5f5; }
.wf-tag.yellow { border-color: #bbb; color: #555; background: #f5f5f5; }
.wf-tag.gray { background: #f0f0f0; border-color: #ddd; color: var(--text-muted); }

/* ---- kpi ---- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { border: 1px solid var(--border-light); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); border-top: 3px solid var(--border); }
.kpi .kpi-label { font-size: 10px; color: var(--text-muted); }
.kpi .kpi-val { font-size: 22px; font-weight: 700; margin: 4px 0 2px; }
.kpi .kpi-note { font-size: 10px; color: var(--text-light); }
.kpi.warn { border-top-color: #555; } .kpi.warn .kpi-val { color: #333; }
.kpi.ok { border-top-color: #999; }

/* ---- overlay / modal ---- */
.wf-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200; display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease; }
.wf-overlay.hidden { display: none; }
.wf-modal { background: var(--surface); border-radius: var(--radius); width: 560px; max-width: 95vw; max-height: 85vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border-top: 3px solid #ddd; animation: scaleIn .2s ease; }
.wf-modal.lg { width: 780px; }
.wf-modal.sm { width: 360px; }
.wf-modal-head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border-light); }
.wf-modal-head .title { font-size: 14px; font-weight: 700; flex: 1; }
.wf-modal-head .close { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: var(--radius-sm); color: var(--text-muted); transition: all .12s; }
.wf-modal-head .close:hover { background: #eee; color: var(--text); }
.wf-modal-body { padding: 14px; overflow: auto; flex: 1; }
.wf-modal-foot { padding: 10px 14px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-alt); }

/* ---- progress ---- */
.wf-progress { height: 6px; background: #e5e5e5; border-radius: 3px; overflow: hidden; }
.wf-progress .bar { height: 100%; background: #888; border-radius: 3px; transition: width .4s ease; }
.wf-progress .bar.warn { background: #555; }
.wf-progress .bar.mid { background: #aaa; }

/* ---- tip ---- */
.wf-tip { padding: 8px 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); font-size: 11px; color: var(--text-sec); background: var(--surface-alt); margin: 8px 0; display: flex; align-items: center; gap: 6px; }
.wf-tip.error { border-color: #999; color: #333; background: #f0f0f0; }
.wf-tip.warn { border-color: #bbb; color: #555; background: #f5f5f5; }

/* ---- alert tip ---- */
.alert-tip { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12px; border: 1px solid var(--border-light); margin-bottom: 8px; cursor: pointer; transition: background .12s; }
.alert-tip:hover { background: var(--surface-alt); }
.alert-tip .at-ico { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--text-muted); }
.alert-tip .at-title { font-weight: 600; margin-bottom: 2px; font-size: 12px; }
.alert-tip .at-desc { font-size: 11px; color: var(--text-sec); line-height: 1.5; }
.alert-tip .at-time { font-size: 10px; color: var(--text-light); margin-top: 4px; }
.alert-tip.error { border-color: #ccc; background: #f8f8f8; }
.alert-tip.error .at-title { color: #333; }
.alert-tip.warn { border-color: #ddd; background: #fafafa; }
.alert-tip.warn .at-title { color: #555; }

/* ---- toast ---- */
.wf-toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 6px; }
.wf-toast-item { background: var(--surface); border-left: 3px solid #888; box-shadow: var(--shadow); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; display: flex; align-items: center; gap: 6px; min-width: 200px; animation: slideUp .25s ease; }
.wf-toast-item.warn { border-left-color: #999; }
.wf-toast-item.error { border-left-color: #555; }
.wf-toast-item.out { animation: slideOut .2s ease forwards; }

/* ---- confirm ---- */
.wf-confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 250; display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease; }
.wf-confirm-box { background: var(--surface); border-radius: var(--radius); width: 340px; padding: 20px; box-shadow: var(--shadow-lg); border-top: 3px solid #ddd; animation: scaleIn .2s ease; }
.wf-confirm-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.wf-confirm-msg { font-size: 12px; color: var(--text-sec); margin-bottom: 16px; line-height: 1.6; }
.wf-confirm-btns { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- tooltip ---- */
.wf-tooltip { position: relative; display: inline-flex; cursor: help; }
.wf-tooltip .tip-text { visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 4px 8px; border-radius: var(--radius-sm); font-size: 10px; white-space: nowrap; z-index: 50; transition: opacity .15s; pointer-events: none; }
.wf-tooltip .tip-text::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -4px; border: 4px solid transparent; border-top-color: #333; }
.wf-tooltip:hover .tip-text { visibility: visible; opacity: 1; }

/* ---- skeleton ---- */
.skeleton { background: linear-gradient(90deg, #e5e5e5 25%, #f0f0f0 50%, #e5e5e5 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }

/* ---- drag ---- */
.drag-over-top { border-top: 2px solid #333 !important; }
.stop-card.dragging { border: 1.5px dashed #999 !important; background: #f5f5f5 !important; opacity: .7; }

/* ---- expand ---- */
.expand-detail { overflow: hidden; max-height: 0; transition: max-height .3s ease; }
.expand-detail.show { max-height: 400px; }

/* ---- map placeholder ---- */
.map-placeholder { width: 100%; height: 100%; background: #e8e6e3 url('map-bg.svg') center/cover no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.map-placeholder .map-label { position: absolute; bottom: 8px; right: 8px; z-index: 1; color: #999; text-align: right; background: rgba(255,255,255,.7); padding: 3px 8px; border-radius: 3px; font-size: 10px; }
.map-placeholder .map-label .map-title { display: none; }
.map-placeholder .map-label .map-sub { font-size: 10px; }
.map-placeholder .map-pins { position: absolute; inset: 0; }
.map-pin { position: absolute; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; background: #555; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.map-pin.red { background: #444; }
.map-pin.gray { background: #999; }
.map-pin.green { background: #777; }

/* ---- chart placeholder ---- */
.chart-ph { height: 160px; background: #f5f5f5; border: 1px solid var(--border-light); border-radius: var(--radius-sm); position: relative; overflow: hidden; }
.chart-ph .chart-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: #bbb; font-size: 11px; z-index: 2; }
.chart-ph .chart-y { position: absolute; left: 0; top: 10px; bottom: 30px; width: 30px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-right: 4px; }
.chart-ph .chart-y span { font-size: 8px; color: #ccc; }
.chart-ph .chart-x { position: absolute; bottom: 0; left: 30px; right: 10px; height: 24px; display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 4px; }
.chart-ph .chart-x span { font-size: 8px; color: #ccc; }
.chart-ph .chart-area { position: absolute; left: 30px; top: 10px; right: 10px; bottom: 24px; border-left: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; }
.chart-ph .chart-gridline { position: absolute; left: 0; right: 0; height: 1px; background: #eee; }
.bar-sim { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: flex-end; gap: 4px; padding: 0 6px; }
.bar-sim .b { background: #ccc; border-radius: 2px 2px 0 0; flex: 1; transition: height .5s ease; }
.line-sim { position: absolute; inset: 0; }
.line-sim polyline { fill: none; stroke: #bbb; stroke-width: 2; }
.line-sim .area { fill: #e5e5e5; opacity: .3; }

/* ---- utils ---- */
.flex { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.hidden { display: none !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; flex-shrink: 0; }
.dot-g { background: #999; } .dot-r { background: #555; } .dot-y { background: #aaa; } .dot-gray { background: #ccc; }
.text-muted { color: var(--text-muted); } .text-sec { color: var(--text-sec); } .text-sm { font-size: 11px; } .text-xs { font-size: 10px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-2col .span2 { grid-column: 1 / -1; }
.spin { animation: spin 2s linear infinite; display: inline-block; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 11px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-light); }
