:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --line: #e4e9ef;
  --text: #15212d;
  --muted: #667684;
  --primary: #087f7a;
  --primary-dark: #05635f;
  --primary-soft: #e8f6f4;
  --success: #16845b;
  --warning: #d17a00;
  --danger: #d14343;
  --shadow: 0 8px 28px rgba(28, 43, 54, .07);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; color: #eaf7f5; background: linear-gradient(180deg, #0c3535 0%, #102c36 100%); }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 8px 34px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: white; font-weight: 800; background: #13a39a; box-shadow: 0 6px 18px #0003; }
.brand strong { display: block; font-size: 16px; }
.brand small { color: #9fc4c1; }
.nav { display: grid; gap: 7px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 10px; color: #b9cfcd; text-align: left; background: transparent; }
.nav button:hover, .nav button.active { color: white; background: #ffffff14; }
.nav-icon { width: 24px; text-align: center; font-size: 18px; }
.sidebar-foot { position: absolute; right: 18px; bottom: 24px; left: 18px; padding: 13px; border: 1px solid #ffffff17; border-radius: 12px; color: #a9c7c4; background: #ffffff0a; }
.sidebar-foot strong { display: block; color: #e8f5f4; }
.main { min-width: 0; padding: 28px clamp(18px, 3vw, 44px) 52px; }
.topbar { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 24px; }
.topbar h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.5px; }
.topbar p { margin: 3px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.room-picker { display: flex; align-items: center; gap: 7px; padding: 5px 6px 5px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: white; }
.room-picker span { font-size: 12px; font-weight: 700; }
.room-picker select { max-width: 150px; border: 0; color: var(--text); background: transparent; outline: none; }
.live { display: inline-flex; gap: 7px; align-items: center; color: var(--success); font-weight: 700; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px #16845b1c; }
.btn { border: 1px solid var(--line); border-radius: 9px; padding: 9px 14px; color: var(--text); background: white; }
.btn:hover { border-color: #b9c7ce; }
.btn.primary { border-color: var(--primary); color: white; background: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.page { display: none; min-width: 0; }
.page.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric, .panel, .device-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.metric { min-height: 120px; padding: 18px; border-radius: 14px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 7px; font-size: 30px; line-height: 1.15; font-weight: 750; }
.metric-hint { margin-top: 7px; color: var(--muted); font-size: 12px; }
.metric.danger .metric-value { color: var(--danger); }
.metric.warning .metric-value { color: var(--warning); }
.room-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 14px; }
.room-summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 4px 16px #1c2b3608; }
.room-summary.active { border-color: #71bdb7; background: var(--primary-soft); }
.room-summary button { all: unset; display: contents; cursor: pointer; }
.room-summary strong { display: block; }
.room-summary small { color: var(--muted); }
.room-numbers { color: var(--muted); text-align: right; font-size: 12px; }
.room-numbers b { display: block; color: var(--primary); font-size: 18px; }
.room-numbers em { display: block; color: var(--success); font-style: normal; font-weight: 700; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin: 24px 0 12px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); }
.devices-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.room-section + .room-section { margin-top: 22px; }
.room-section-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin: 0 2px 10px; }
.room-section-head h3 { margin: 0; font-size: 16px; }
.room-section-head span { color: var(--muted); font-size: 12px; }
.device-card { padding: 18px; border-radius: 14px; }
.device-card.offline { opacity: .74; }
.device-head { display: flex; justify-content: space-between; gap: 12px; }
.device-title { display: flex; gap: 11px; align-items: center; }
.device-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--primary); font-weight: 800; background: var(--primary-soft); }
.device-card.offline .device-avatar { color: #7a8790; background: #edf0f2; }
.device-snapshot-wrap { position: relative; flex: 0 0 auto; }
.device-snapshot { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; padding: 0; border: 1px solid #b8d9d5; border-radius: 11px; color: var(--primary); background: var(--primary-soft); transition: .18s ease; }
.device-snapshot:hover:not(:disabled), .device-snapshot:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px #0a8d8420; transform: translateY(-1px); outline: none; }
.device-snapshot:disabled { cursor: wait; opacity: .6; }
.device-snapshot.has-image { background: #e7edef; }
.device-snapshot img { width: 100%; height: 100%; object-fit: cover; }
.snapshot-computer { font-size: 21px; line-height: 1; }
.snapshot-preview { position: fixed; z-index: 30; top: var(--preview-top, -9999px); left: var(--preview-left, -9999px); display: none; width: min(360px, calc(100vw - 24px)); padding: 8px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); font-size: 12px; text-decoration: none; background: #fff; box-shadow: 0 14px 34px #132b3030; }
.snapshot-preview img { display: block; width: 344px; height: 344px; object-fit: contain; border-radius: 7px; background: #15212d; }
.snapshot-preview span { display: block; padding: 6px 3px 0; }
.device-snapshot-wrap:hover .snapshot-preview, .device-snapshot-wrap:focus-within .snapshot-preview { display: block; }
.device-title h3 { margin: 0; font-size: 16px; }
.device-title small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; height: 25px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.online, .badge.Completed, .badge.Info { color: var(--success); background: #e8f6ef; }
.badge.offline { color: #69747b; background: #edf0f2; }
.badge.Warning, .badge.Running { color: var(--warning); background: #fff4df; }
.badge.Error, .badge.Failed { color: var(--danger); background: #feecec; }
.badge.Pending { color: #3267b1; background: #e9f1fd; }
.business { margin: 17px 0 8px; font-weight: 650; }
.stale-notice { margin: 12px 0 8px; padding: 8px 10px; color: #69747b; font-size: 12px; line-height: 1.45; background: #f2f4f5; border-left: 3px solid #b7c0c5; }
.stale-business { color: #69747b; }
.project-summary { margin: 8px 0; padding: 8px 10px; border-left: 3px solid #38b99f; color: #315e54; font-size: 12px; line-height: 1.55; background: #f3faf7; word-break: break-word; }
.project-preview { margin: 8px 0; }
.project-preview a { display: inline-block; text-decoration: none; }
.project-preview img { display: block; width: 250px; height: 78px; object-fit: cover; object-position: center; border: 1px solid #b8d9d5; border-radius: 7px; background: #f3faf7; }
.stale-summary { color: #69747b; background: #f2f4f5; border-left-color: #b7c0c5; }
.progress-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.progress { height: 8px; margin: 7px 0 14px; overflow: hidden; border-radius: 99px; background: #edf1f3; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #08a098, #38b99f); }
.port-list { display: flex; flex-wrap: wrap; gap: 7px; }
.port { padding: 6px 9px; border-radius: 8px; color: #276251; font-size: 12px; background: #edf8f3; }
.port.bad { color: #a13a31; background: #fff0ee; }
.port.stale { color: #69747b; background: #f0f2f3; }
.device-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.panel { min-width: 0; padding: 20px; border-radius: 14px; }
.panel + .panel { margin-top: 16px; }
.huohu-panel { margin-bottom: 22px; }
.huohu-heading { margin-top: 0; }
.huohu-metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; }
.business-metric-grid, .finance-metric-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
.huohu-metric { min-height: 104px; padding: 15px; border: 1px solid #dce9e6; border-radius: 11px; background: #f7fbfa; }
.huohu-metric span, .huohu-metric small { display: block; color: var(--muted); font-size: 12px; }
.huohu-metric strong { display: block; margin: 6px 0 4px; color: #164a48; font-size: 22px; line-height: 1.2; }
.huohu-metric.accent { border-color: #9ed8d1; background: var(--primary-soft); }
.huohu-metric.accent strong { color: var(--primary-dark); }
.huohu-metric.warning { border-color: #efc880; background: #fff9ee; }
.huohu-metric.warning strong { color: var(--warning); }
.huohu-metric.realtime-kpi { width: 100%; appearance: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.huohu-metric.realtime-kpi:hover { border-color: #8ccdc5; transform: translateY(-1px); }
.huohu-metric.realtime-kpi:focus-visible { outline: 3px solid #9ed8d1; outline-offset: 2px; }
.huohu-metric.realtime-kpi.active { border-color: #53b9ad; background: var(--primary-soft); box-shadow: inset 0 -3px 0 #53b9ad; }
.huohu-metric.realtime-kpi.active strong { color: var(--primary-dark); }
.realtime-metric-grid { margin-top: 4px; }
.realtime-trend-panel { margin-top: 16px; padding: 16px 16px 10px; border: 1px solid #dce9e6; border-radius: 11px; background: #fbfdfd; }
.realtime-trend-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.realtime-trend-heading h3 { margin: 0; font-size: 15px; }
.realtime-trend-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.realtime-trend-controls { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.realtime-trend-controls button { display: inline-flex; gap: 6px; align-items: center; padding: 5px 9px; border: 1px solid #d8e4e2; border-radius: 999px; color: #647278; font-size: 12px; background: #fff; }
.realtime-trend-controls button.active { border-color: #9acfc8; color: #173f3b; background: #eff9f7; }
.realtime-trend-controls button:focus-visible { outline: 3px solid #9ed8d1; outline-offset: 2px; }
.realtime-trend-controls i { display: inline-block; width: 15px; height: 0; border-top: 3px solid #168a7d; }
.realtime-trend-controls i.hourly { border-top-color: #d9822b; border-top-style: dashed; }
.realtime-trend-estimate-key { display: inline-flex; gap: 5px; align-items: center; margin-right: 2px; color: #786225; font-size: 12px; }
.realtime-trend-estimate-key i { width: 0; height: 0; border: 0; border-right: 6px solid transparent; border-bottom: 10px solid #b58b20; border-left: 6px solid transparent; }
.realtime-trend-chart { width: 100%; max-width: 100%; min-height: 250px; margin-top: 8px; overflow: hidden; }
.realtime-trend-chart svg { display: block; width: 100%; height: auto; min-height: 250px; }
.realtime-trend-grid { stroke: #e4eeec; stroke-width: 1; }
.realtime-trend-hour-grid { stroke: #edf3f2; stroke-width: 1; }
.realtime-trend-axis { fill: #718086; font-size: 11px; }
.realtime-trend-empty-label { fill: #879497; font-size: 13px; font-weight: 650; }
.realtime-trend-line { fill: none; stroke: #168a7d; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.realtime-trend-line.hourly { stroke: #d9822b; stroke-width: 2.5; stroke-dasharray: 7 5; }
.realtime-trend-point { fill: #fff; stroke: #168a7d; stroke-width: 2.5; }
.realtime-trend-point.cumulative.latest { fill: #168a7d; }
.realtime-trend-point.hourly { fill: #fff7ed; stroke: #d9822b; stroke-width: 2.5; }
.realtime-trend-point.hourly.latest { fill: #d9822b; }
.realtime-trend-point.estimated { fill: #fff2bf; stroke: #8a6818; stroke-width: 2.4; }
.realtime-trend-point.estimated.latest { fill: #d8aa35; }
.realtime-trend-missing { fill: #a4afb2; font-size: 14px; font-weight: 700; }
.realtime-warning { display: none; margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--warning); border-radius: 7px; color: #85520a; font-size: 13px; background: #fff7e8; }
.realtime-warning.show { display: block; }
.huohu-platform-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; justify-content: flex-end; }
.huohu-platform-controls label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.huohu-platform-controls select, .date-range select { min-height: 36px; border: 1px solid #d8e0e5; border-radius: 8px; padding: 6px 9px; color: var(--text); background: #fff; }
.platform-tag { display: inline-block; margin-right: 5px; padding: 1px 6px; border: 1px solid #b9dcd7; border-radius: 999px; color: #176d64; font-size: 11px; font-weight: 700; background: #edf8f6; vertical-align: 1px; }
.platform-tag.worldcode { border-color: #c9c8e8; color: #5551a1; background: #f3f2fb; }
.platform-tag.unknown { border-color: #d8dee0; color: #65757b; background: #f5f7f7; }
.realtime-account-panel { min-width: 0; margin-top: 18px; padding-top: 16px; border-top: 1px solid #e4ecea; }
.realtime-account-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.realtime-account-heading h3 { margin: 0; font-size: 15px; }
.realtime-account-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.realtime-account-heading .btn { padding: 7px 11px; }
.realtime-account-heading .btn:disabled { cursor: default; opacity: .5; }
.realtime-account-table { min-width: 720px; }
.realtime-account-table th { padding-top: 8px; padding-bottom: 8px; }
.realtime-account-table th button { padding: 2px 0; border: 0; color: var(--muted); font-size: 12px; font-weight: 700; background: transparent; }
.realtime-account-table th button:hover, .realtime-account-table th button.active { color: var(--primary-dark); }
.realtime-account-table th button:focus-visible { outline: 2px solid #71c4ba; outline-offset: 3px; }
.realtime-account-row { cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.realtime-account-row:hover { background: #f3faf8; }
.realtime-account-row.selected { background: #eaf7f4; box-shadow: inset 4px 0 0 #168a7d; }
.realtime-account-row:focus-visible { outline: 3px solid #8ed0c8; outline-offset: -3px; }
.realtime-account-row td:first-child strong { color: #183f3b; }
.realtime-docking-panel { min-width: 0; margin-top: 18px; padding-top: 16px; border-top: 1px solid #e4ecea; }
.realtime-docking-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 8px; }
.realtime-docking-heading h3 { margin: 0; font-size: 15px; }
.realtime-docking-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.realtime-docking-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; justify-content: flex-end; }
.realtime-docking-controls label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.realtime-docking-controls select { min-width: 220px; min-height: 36px; border: 1px solid #d8e0e5; border-radius: 8px; padding: 6px 9px; color: var(--text); background: white; }
.realtime-docking-controls .btn { min-height: 36px; padding: 7px 11px; }
.realtime-docking-controls .btn:disabled { cursor: default; opacity: .5; }
.realtime-docking-table { min-width: 850px; }
.realtime-docking-table th { padding-top: 8px; padding-bottom: 8px; }
.realtime-docking-table th button { padding: 2px 0; border: 0; color: var(--muted); font-size: 12px; font-weight: 700; background: transparent; }
.realtime-docking-table th button:hover, .realtime-docking-table th button.active { color: var(--primary-dark); }
.realtime-docking-table th button:focus-visible { outline: 2px solid #71c4ba; outline-offset: 3px; }
.realtime-docking-row { cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.realtime-docking-row:hover { background: #f3faf8; }
.realtime-docking-row.selected { background: #eaf7f4; box-shadow: inset 4px 0 0 #168a7d; }
.realtime-docking-row:focus-visible { outline: 3px solid #8ed0c8; outline-offset: -3px; }
.realtime-docking-row td:first-child strong { color: #183f3b; }
.realtime-breakdowns { gap: 22px; }
.huohu-breakdowns { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 20px; }
.huohu-breakdowns > div { min-width: 0; }
.huohu-breakdowns h3 { margin: 0 0 8px; font-size: 14px; }
.huohu-empty { padding: 22px; border: 1px dashed #cad6d6; border-radius: 10px; color: var(--muted); text-align: center; background: var(--surface-muted); }
.date-range { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.date-range label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.date-range input { min-height: 36px; border: 1px solid #d8e0e5; border-radius: 8px; padding: 6px 8px; color: var(--text); background: white; }
.date-range .btn { min-height: 36px; padding: 7px 12px; }
.trend-card { margin-top: 20px; padding: 15px; border: 1px solid #e2ebe9; border-radius: 11px; background: #fbfdfd; }
.trend-card h3 { margin: 0; font-size: 15px; }
.trend-card p { margin: 3px 0 10px; color: var(--muted); font-size: 12px; }
.trend-chart { min-height: 160px; overflow-x: auto; }
.trend-chart svg { display: block; min-width: 520px; width: 100%; height: 250px; }
.trend-chart .grid { stroke: #e5ebeb; stroke-width: 1; }
.trend-chart .axis-label, .trend-chart .value-label { fill: #667684; font-size: 11px; }
.trend-chart .axis { stroke: #9fb0b5; stroke-width: 1; }
.trend-chart .axis-title { fill: #667684; font-size: 11px; font-weight: 700; }
.trend-chart .bar-income-total { fill: #0b8b83; }
.trend-chart .bar-income-total:hover { fill: #086e68; }
.trend-chart .bar-success { fill: #0b8b83; }
.trend-chart .bar-not-success { fill: #b6c7c5; }
.trend-chart .bar-expense { fill: #3d77a8; }
.trend-chart .bar-income { fill: #d6a035; }
.trend-chart .bar-revenue { fill: #0b8b83; }
.trend-chart .success-line { fill: none; stroke: #d17a00; stroke-width: 2.5; }
.trend-chart .success-dot { fill: white; stroke: #d17a00; stroke-width: 2; }
.trend-chart .legend { fill: #41525d; font-size: 11px; }
.bar-trend { display: flex; align-items: end; gap: 12px; min-width: max-content; height: 220px; padding: 8px 12px 0; border-bottom: 1px solid #dbe5e4; }
.trend-day { display: grid; grid-template-rows: 165px auto auto; min-width: 52px; gap: 4px; text-align: center; }
.trend-bars { display: flex; align-items: end; justify-content: center; gap: 3px; height: 165px; padding-bottom: 2px; border-bottom: 1px solid #e6eeee; }
.trend-bar { display: block; width: 10px; min-height: 2px; border-radius: 3px 3px 0 0; }
.trend-bar.success, .trend-bar.revenue { background: #0b8b83; }
.trend-bar.not-success { background: #9fb3b1; }
.trend-bar.expense { background: #3d77a8; }
.trend-bar.income { background: #d6a035; }
.trend-day strong { color: #40515c; font-size: 11px; font-weight: 700; }
.trend-day small { max-width: 74px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.daily-supply-panel { min-width: 0; margin-top: 20px; padding-top: 17px; border-top: 1px solid #e4ecea; }
.daily-supply-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.daily-supply-heading h3, .daily-supply-account-heading h3 { margin: 0; font-size: 15px; }
.daily-supply-heading p, .daily-supply-account-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.daily-supply-table { min-width: 560px; }
.daily-supply-account-table { min-width: 700px; }
.daily-finance-table { min-width: 420px; }
.daily-finance-account-table { min-width: 560px; }
.daily-supply-table th, .daily-supply-account-table th { padding-top: 8px; padding-bottom: 8px; }
.daily-supply-table th button, .daily-supply-account-table th button { padding: 2px 0; border: 0; color: var(--muted); font-size: 12px; font-weight: 700; background: transparent; }
.daily-supply-table th button:hover, .daily-supply-table th button.active, .daily-supply-account-table th button:hover, .daily-supply-account-table th button.active { color: var(--primary-dark); }
.daily-supply-table th button:focus-visible, .daily-supply-account-table th button:focus-visible { outline: 2px solid #71c4ba; outline-offset: 3px; }
.daily-supply-row, .daily-finance-row { cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.daily-supply-row:hover, .daily-finance-row:hover { background: #f3faf8; }
.daily-supply-row.selected, .daily-finance-row.selected { background: #eaf7f4; box-shadow: inset 4px 0 0 #168a7d; }
.daily-supply-row:focus-visible, .daily-finance-row:focus-visible { outline: 3px solid #8ed0c8; outline-offset: -3px; }
.daily-supply-row td:first-child strong, .daily-finance-row td:first-child strong, .daily-supply-account-table td:nth-child(2) strong { color: #183f3b; }
.daily-supply-account-panel { margin-top: 18px; padding: 16px; border: 1px solid #dce9e6; border-radius: 11px; background: #fbfdfd; }
.daily-supply-account-panel[hidden] { display: none; }
.daily-supply-account-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.daily-supply-account-heading .btn { padding: 7px 11px; }
.split { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(0, 1.4fr); gap: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 13px; }
.field label { color: var(--muted); font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d8e0e5; border-radius: 9px; padding: 10px 11px; color: var(--text); background: white; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #5db9b2; box-shadow: 0 0 0 3px #0a8d8420; }
.field textarea { min-height: 86px; resize: vertical; }
.alert-heading { align-items: center; margin-top: 0; }
.alert-telegram-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; justify-content: flex-end; }
.alert-config-note { margin: -2px 0 14px; padding: 10px 12px; border-left: 3px solid #77b8b1; color: var(--muted); font-size: 12px; background: var(--surface-muted); }
.telegram-config-form { margin-bottom: 20px; padding: 15px; border: 1px solid #dce9e6; border-radius: 11px; background: #fbfdfd; }
.telegram-config-grid { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) minmax(280px, 1.35fr); gap: 12px; }
.telegram-config-grid .field { margin-bottom: 8px; }
.field-label-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.btn.compact { padding: 4px 8px; font-size: 11px; }
.telegram-chat-results { display: grid; gap: 7px; margin: 3px 0 14px; padding: 10px; border: 1px dashed #bdd8d4; border-radius: 9px; background: #f3faf8; }
.telegram-chat-results[hidden] { display: none; }
.telegram-chat-result { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 9px; border-radius: 8px; background: white; }
.telegram-chat-result strong { display: block; font-size: 13px; }
.telegram-chat-result small { color: var(--muted); }
.telegram-chat-result .btn { flex: 0 0 auto; padding: 6px 9px; }
.telegram-chat-message { margin: 0; color: var(--muted); font-size: 12px; }
.telegram-config-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.telegram-config-actions label { color: var(--text); font-size: 13px; }
.telegram-config-actions input[type="checkbox"] { width: 17px; height: 17px; vertical-align: -3px; accent-color: var(--primary); }
.telegram-clear-token { color: var(--danger) !important; }
.telegram-security-note { display: block; margin-top: 10px; color: var(--muted); }
.briefing-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.briefing-rule { padding: 15px; background: #fbfdfd; border: 1px solid #dce9e6; border-radius: 11px; }
.briefing-rule h3 { margin: 0 0 14px; font-size: 15px; }
.briefing-rule .briefing-toggle { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.briefing-note { color: var(--muted); font-size: 12px; line-height: 1.8; }
.briefing-preview-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.briefing-preview-controls .field { flex: 1; min-width: 200px; margin: 0; }
.briefing-preview-box { margin-top: 16px; padding: 16px; border: 1px solid #dce9e6; border-radius: 12px; background: #eef5f3; }
.briefing-preview-box[hidden] { display: none; }
.briefing-message { white-space: pre-wrap; overflow-wrap: anywhere; background: white; padding: 16px; margin-bottom: 12px; border-radius: 0 12px 12px; line-height: 1.9; max-width: 580px; }
.briefing-message i { color: var(--muted); font-size: 12px; }
.briefing-history-note { white-space: normal; max-width: 280px; color: var(--muted); }
@media (max-width: 760px) { .briefing-rules { grid-template-columns: 1fr; } .briefing-preview-controls .field { flex-basis: 100%; } }
.alert-rules-table { min-width: 900px; }
.alert-rules-table th, .alert-rules-table td { padding-right: 6px; padding-left: 6px; }
.alert-rules-table td { vertical-align: middle; }
.alert-rules-table td:first-child, .alert-rules-table td:last-child { text-align: center; }
.alert-rules-table select, .alert-rules-table input[type="number"] { min-height: 36px; border: 1px solid #d8e0e5; border-radius: 8px; padding: 6px 8px; color: var(--text); background: white; }
.alert-rules-table select { min-width: 120px; }
.alert-rules-table input[type="number"] { width: 72px; }
.alert-rules-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.alert-rule-description { display: block; max-width: 190px; margin-top: 3px; color: var(--muted); white-space: normal; }
.compact-field { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.alert-save-actions { align-items: center; margin-top: 16px; }
.alert-save-actions small { color: var(--muted); }
.table-wrap { width: 100%; max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid #edf0f2; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; }
td { font-size: 13px; }
.message-list { display: grid; gap: 10px; }
.message { display: grid; grid-template-columns: 8px 1fr auto; gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); }
.message.action-required { border-color: #edc67d; background: #fffaf0; box-shadow: inset 0 0 0 1px #f5ddb2; }
.message-dot { width: 8px; height: 38px; border-radius: 99px; background: #78a3a0; }
.message-dot.Error { background: var(--danger); }
.message-dot.Warning { background: var(--warning); }
.message p { margin: 0; font-size: 15px; line-height: 1.65; font-weight: 650; white-space: pre-wrap; }
.message small { color: var(--muted); }
.message-main { min-width: 0; }
.message-meta { display: block; margin-top: 5px; }
.message-status { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 9px; }
.message-status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; color: #7b4b00; background: #fff0cf; }
.message-status-badge.Completed { color: #126642; background: #daf2e6; }
.message-status-badge.Processing { color: #8a5000; background: #ffedc7; }
.message-status-badge.Pending { color: #a83232; background: #fde1e1; }
.message-receipt { margin-top: 7px; padding: 7px 9px; border-left: 3px solid #5aa99d; color: #43565c; font-size: 12px; background: #ffffffa8; }
.message-action-toggle { display: flex; gap: 9px; align-items: flex-start; margin: 2px 0 14px; padding: 11px 12px; border: 1px solid #ead7ae; border-radius: 9px; background: #fffaf0; cursor: pointer; }
.message-action-toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--warning); }
.message-action-toggle span, .message-action-toggle small { display: block; }
.message-action-toggle small { margin-top: 2px; color: var(--muted); }
.empty { padding: 36px 18px; color: var(--muted); text-align: center; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 16px; border-radius: 10px; color: white; background: #263942; box-shadow: 0 12px 30px #0003; transform: translateY(90px); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 20% 0%, #ccece8 0, transparent 36%), linear-gradient(135deg, #edf6f5, #f6f8fa 58%); }
.login-card { width: min(430px, 100%); padding: 30px; border: 1px solid #dce7e5; border-radius: 18px; background: #fffc; box-shadow: 0 22px 60px #173a3820; backdrop-filter: blur(12px); }
.login-card .brand { margin: 0 0 28px; color: var(--text); }
.login-card .brand small { color: var(--muted); }
.login-card h1 { margin: 0; font-size: 27px; }
.login-card > p { margin: 6px 0 22px; color: var(--muted); }
.login-card .btn { width: 100%; padding: 11px; }
.demo-tip { margin-top: 20px; padding: 12px; border-radius: 9px; color: #53656f; font-size: 12px; background: #f1f5f6; }
.error-text { min-height: 22px; color: var(--danger); font-size: 13px; }
.mobile-nav { display: none; }

@media (max-width: 1040px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .huohu-metric-grid { grid-template-columns: repeat(3, 1fr); }
  .devices-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { padding: 18px 14px 82px; }
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .room-picker { order: 3; width: 100%; }
  .room-picker select { flex: 1; max-width: none; }
  .top-actions .btn.screen-link { display: none; }
  .topbar h1 { font-size: 25px; }
  .topbar p { font-size: 13px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .huohu-metric-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .realtime-trend-panel { padding: 14px 10px 8px; }
  .realtime-trend-heading { flex-direction: column; }
  .realtime-account-heading { align-items: center; }
  .realtime-docking-heading { flex-direction: column; }
  .realtime-docking-controls { width: 100%; justify-content: flex-start; }
  .realtime-docking-controls label { flex: 1; }
  .realtime-docking-controls select { width: 100%; min-width: 0; }
  .realtime-trend-chart { min-height: 220px; overflow-x: auto; }
  .realtime-trend-chart svg { min-width: 680px; min-height: 220px; }
  .date-range { width: 100%; }
  .metric { min-height: 104px; padding: 14px; }
  .metric-value { font-size: 25px; }
  .split { grid-template-columns: 1fr; }
  .alert-heading { align-items: flex-start; flex-direction: column; }
  .alert-telegram-actions { justify-content: flex-start; }
  .telegram-config-grid { grid-template-columns: 1fr; gap: 0; }
  .telegram-config-actions { align-items: flex-start; flex-direction: column; }
  .telegram-chat-result { align-items: flex-start; }
  .alert-save-actions { align-items: flex-start; flex-direction: column; }
  .mobile-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(7, 1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #ffffffed; backdrop-filter: blur(12px); }
  .mobile-nav button { border: 0; padding: 7px 2px; color: var(--muted); font-size: 11px; background: transparent; }
  .mobile-nav button span { display: block; font-size: 18px; }
  .mobile-nav button.active { color: var(--primary); font-weight: 700; }
  .message { grid-template-columns: 7px 1fr; }
  .message > small { grid-column: 2; }
  .snapshot-preview img { width: 100%; height: min(344px, calc(100vw - 64px)); }
}

@media (max-width: 410px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .top-actions .live { display: none; }
}
