html { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; }
:root {
  --bg: #1e1e1e;
  --topbar-bg: #2d2d30;
  --group-border: #3e3e42;
  --group-text: #ffffff;
  
  --text-normal: #dcdcdc;
  --text-muted: #999999;
  
  --cold-text: #00ffff;
  --warm-text: #ffa500;
  --btn-orange: #d2691e;
  --btn-red: #8b0000;
  
  --font-main: "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
.app-shell { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; overflow: hidden; }
body { width: 100%; height: 100%; display: block; overflow: hidden; font-family: var(--font-main); background-color: var(--bg); color: var(--text-normal); font-size: 14px; }

/* Views */
.view { display: none; width: 100%; height: 100%; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.view.is-active { display: flex; }

/* Login */
.login-view { align-items: center; justify-content: center; background: #000; }
.login-panel { background: #1a1a1c; border: 1px solid var(--group-border); border-radius: 4px; padding: 40px; display: flex; flex-direction: column; gap: 20px; width: 400px; }
.login-title h1 { font-size: 20px; color: #fff; font-weight: bold; }
.login-panel label { display: flex; flex-direction: column; gap: 8px; color: var(--text-muted); }
.login-panel input { padding: 12px; background: #0a0a0c; border: 1px solid #333; color: #fff; outline: none; }
.login-button { padding: 12px; background: #007acc; color: #fff; border: none; cursor: pointer; font-weight: bold; }

/* Top Bar */
.top-bar { 
  display: flex; justify-content: space-between; align-items: center; 
  padding: 15px; background: var(--topbar-bg); 
  border-radius: 5px; margin: 10px 10px 10px 10px;
  flex-shrink: 0;
}
.brand-line { display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 24px; color: #007acc; }
.brand-line h1 { font-size: 24px; font-weight: bold; color: #fff; }
.system-badge { background: #007acc; color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 13px; font-weight: bold; margin-left: 12px; }

.status-line { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.price-label { color: yellow; font-size: 15px; }
.price-name.low-sea { color: cyan; }
.price-value.low-sea { color: cyan; font-size: 16px; font-weight: bold; margin-right: 8px; }
.price-name.normal-well { color: #00fa9a; }
.price-value.normal-well { color: #00fa9a; font-size: 16px; font-weight: bold; margin-right: 8px; }
.price-name.normal-sea { color: orange; }
.price-value.normal-sea { color: orange; font-size: 16px; font-weight: bold; margin-right: 8px; }

.readonly-button { padding: 4px 12px; border: none; font-weight: bold; font-size: 14px; cursor: pointer; color: #fff; }
.readonly-button.danger { background: darkred; }
.readonly-button.primary { background: #007acc; }
.readonly-button.neutral { background: #444; }

.comm-label { color: #fff; font-size: 16px; margin-left: 10px; }
.comm-text { color: gray; font-size: 15px; }

.led { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: gray; box-shadow: inset 0 1px 2px rgba(0,0,0,0.5); }
.led.small { width: 10px; height: 10px; }
.led.on { background: #00ffcc; box-shadow: 0 0 5px #00ffcc; }
.led.valve.on { background: orange; box-shadow: 0 0 5px orange; }
.led.warn { background: yellow; box-shadow: 0 0 5px yellow; }

/* GroupBox styling */
.group-box {
  border: 1px solid var(--group-border);
  border-radius: 2px;
  padding: 20px 5px 5px 5px;
  position: relative;
  margin-top: 15px;
  margin-bottom: 10px;
}
.group-title {
  position: absolute;
  top: -12px;
  left: 10px;
  background: var(--bg);
  padding: 0 5px;
  font-size: 16px;
  color: var(--group-text);
  white-space: nowrap;
}
.power-group .group-title { color: lightgray; }
.pool-group.cold-domain .group-title { color: cyan; }
.pool-group.warm-domain .group-title { color: orange; }

/* Layout */
.main-grid { display: flex; gap: 10px; flex: 1; min-height: 0; padding: 0 10px;  }
.left-pane { flex: 3.5; display: flex; flex-direction: column; }
.power-group { flex-shrink: 0; }
.pool-group { flex: 1; display: flex; flex-direction: column; }
.terminal-group { flex: 6.5; display: flex; flex-direction: column; margin-left: 0; }
.log-group { height: 220px; flex-shrink: 0; margin: 0 10px 10px 10px; padding: 15px 5px 5px 5px;  display: flex; flex-direction: column; }

/* Power Controls */
.power-grid { display: flex; flex-direction: column; gap: 8px; padding: 5px; }
.pump-card { display: flex; justify-content: space-between; align-items: center; background: #252526; padding: 6px 12px; border: 1px solid #333; }
.pump-label { font-size: 15px; font-weight: bold; display: flex; align-items: center; gap: 6px; }
.button-pair { display: flex; gap: 4px; }
.mini-button { padding: 4px 10px; border: none; font-weight: bold; color: #fff; cursor: not-allowed; opacity: 0.7; pointer-events: none; }
.mini-button.orange { background: var(--btn-orange); }
.mini-button.red { background: var(--btn-red); }

.master-switches { display: flex; gap: 10px; }
.switch-row { flex: 1; display: flex; justify-content: space-between; align-items: center; background: #252526; padding: 6px 10px; border: 1px solid #333; }
.switch-button { padding: 4px 8px; font-size: 13px; font-weight: bold; color: #fff; border: none; pointer-events: none; opacity: 0.8; }
.switch-button.cold { background: #008b8b; }
.switch-button.warm { background: #b8860b; }
.master-state { font-weight: bold; color: #00fa9a; }

.inlet-card { background: #252526; border: 1px solid #333; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.inlet-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.inlet-row-bottom { justify-content: space-between; }
.inline-state { display: flex; align-items: center; gap: 4px; }
.muted { color: gray; }
.inlet-volume { font-size: 16px; font-weight: bold; color: cyan; }
.sequence-status { font-weight: bold; color: cyan; }
.sequence-detail { color: #ffebcd; }
.radio-chip { color: #fff; padding: 2px 6px; border: 1px solid transparent; pointer-events: none; }
.radio-chip.is-active { border-color: #00ffcc; border-radius: 50%; padding: 2px; }
.readonly-input { background: #111; border: 1px solid #444; padding: 2px 8px; color: cyan; width: 60px; text-align: center; }
.readonly-button { pointer-events: none; opacity: 0.8; }
.readonly-button.primary, .readonly-button.neutral, .readonly-button.danger { pointer-events: auto; opacity: 1; }
.readonly-button.stop { background: var(--btn-red); pointer-events: none; }

.alarm-strip { display: flex; justify-content: space-between; background: #252526; padding: 6px 12px; font-weight: bold; font-size: 14px; }

/* Pools */
.pool-grid { display: flex; gap: 10px; padding: 5px; flex: 1; }
.pool-card { flex: 1; background: #0a0a0c; border: 1px solid #1a1a1a; display: flex; flex-direction: column; padding: 10px; }
.pool-head { font-size: 16px; font-weight: bold; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.pool-card.cold .pool-head { color: var(--cold-text); }
.pool-card.warm .pool-head { color: var(--warm-text); }

.pool-body { display: flex; gap: 15px; flex: 1; min-height: 0; }
.level-column { display: flex; flex-direction: column; align-items: center; width: 40px; }
.level-track { flex: 1; width: 20px; background: #222; border: 1px solid #444; position: relative; border-radius: 2px; }
.level-fill { position: absolute; bottom: 0; left: 0; right: 0; background: #00ffcc; transition: height 0.5s ease; }
.pool-card.warm .level-fill { background: orange; }
.level-percent { font-size: 12px; margin-top: 4px; font-weight: bold; }

.pool-data { display: flex; flex-direction: column; justify-content: center; gap: 10px; flex: 1; font-size: 14px; }
.pool-data-row { display: flex; justify-content: space-between; }
.level-text { color: #00ffcc; font-size: 16px; font-weight: bold; }

/* Terminals */
.terminal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 5px; flex: 1; align-content: start; }
.terminal-card { background: #0a0a0c; border: 1px solid #1a1a1a; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.terminal-head { display: flex; justify-content: space-between; border-bottom: 1px solid #222; padding-bottom: 4px; }
.terminal-name { font-size: 16px; font-weight: bold; }
.terminal-name.low-sea { color: cyan; }
.terminal-name.normal-well { color: #00fa9a; }
.terminal-name.normal-sea { color: orange; }
.terminal-delay { font-size: 12px; color: gray; text-align: right; }

.meter-box { background: #000; border: 1px solid #1a1a1c; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.status-row { display: flex; justify-content: space-between; font-size: 13px; }
.status-value { font-weight: bold; color: cyan; }
.terminal-card.running .status-value { color: #00ffcc; }
.terminal-card.paused .status-value { color: yellow; }
.cost-row, .volume-row { display: flex; align-items: baseline; justify-content: space-between; }
.cost-value { font-size: 20px; font-weight: bold; color: yellow; margin-left: auto; margin-right: 4px; font-family: monospace; }
.volume-value { font-size: 20px; font-weight: bold; color: cyan; margin-left: auto; margin-right: 4px; font-family: monospace; }
.unit-money { color: yellow; font-size: 12px; }
.unit-volume { color: cyan; font-size: 12px; }

.mode-row { display: flex; justify-content: space-around; font-size: 13px; margin: 4px 0; }
.input-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.input-box { display: flex; align-items: center; background: #111; border: 1px solid #333; padding: 2px 6px; color: #00ffcc; width: 100px; justify-content: space-between; }
.stepper { display: flex; flex-direction: column; font-size: 8px; color: gray; cursor: pointer; }

.action-row { display: flex; gap: 4px; margin-top: 4px; }
.action-row button { flex: 1; padding: 6px; font-weight: bold; border: none; cursor: not-allowed; opacity: 0.6; color: #fff; pointer-events: none; }
.start-green { background: #006400; }
.start-cyan { background: #008b8b; }
.start-blue { background: #00008b; }
.pause-yellow { background: #8b8000; }
.stop-red { background: var(--btn-red); }

/* Logs */
.table-wrap { flex: 1 1 0%; height: 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.hmi-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hmi-table th { background: #252526; color: #fff; padding: 8px; text-align: left; font-weight: normal; position: sticky; top: 0; }
.hmi-table td { padding: 8px; border-bottom: 1px solid #2d2d30; }
.hmi-table tbody tr:nth-child(even) { background: #252526; }
.empty-row { text-align: center; color: gray; padding: 20px !important; }


/* ==================== C# WPF Report Clone Styles ==================== */
.report-container { display: flex; flex-direction: column; padding: 12px;  background: #1e1e1e; font-size: 14px; gap: 10px; flex: 1; min-height: 0; overflow: hidden; }
.rep-panel { background: #2d2d30; border-radius: 6px; padding: 14px; border: 1px solid #3e3e42; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; }
.rep-filter-panel, .rep-summary-panel { background: #252526; padding: 12px; }

/* Top Panel */
.rep-top-panel { display: flex; justify-content: space-between; align-items: center; }
.rep-title-box { display: flex; align-items: center; }
.rep-icon { font-size: 24px; margin-right: 8px; }
.rep-title-box h2 { font-size: 22px; font-weight: bold; color: white; margin: 0; }
.rep-range-title { color: #00ffcc; font-size: 16px; margin-left: 18px; margin-top: 3px; }

.rep-buttons-box { display: flex; align-items: center; }
.rep-btn { width: 68px; height: 30px; margin-right: 8px; background: #3e3e42; color: white; font-weight: bold; border: none; cursor: pointer; border-radius: 2px; }
.rep-btn.day, .rep-btn.active { background: #007acc; }
.rep-btn.custom { width: 78px; background: #ca5100; margin-right: 0; }
.rep-btn.back-btn { background: #444; width: 80px; }

/* Filter Panel */
.rep-filter-panel { display: flex; justify-content: space-between; align-items: center; }
.rep-filter-left { display: flex; align-items: center; }
.rep-filter-left label { color: lightgray; font-size: 15px; margin-right: 6px; margin-left: 14px; }
.rep-filter-left label:first-child { margin-left: 0; }
.rep-date-picker { width: 135px; height: 28px; background: #111; color: white; border: 1px solid #444; padding: 2px 4px; }
.rep-select { width: 100px; height: 28px; background: #111; color: white; border: 1px solid #444; }
.rep-action-btn { height: 30px; font-weight: bold; border: none; cursor: pointer; color: white; border-radius: 2px; }
.query-btn { width: 80px; background: #007acc; margin: 0 10px 0 15px; }
.refresh-btn { width: 70px; background: #3e3e42; margin-right: 18px; }
.export-btn { width: 80px; background: #28a745; margin-right: 18px; }

.rep-filter-right { display: flex; align-items: center; }
.rep-total-label { color: yellow; font-size: 15px; font-weight: bold; margin-right: 8px; }
.rep-muted { color: gray; font-size: 14px; margin-right: 4px; margin-left: 14px; }
.rep-muted:first-of-type { margin-left: 0; }
.rep-cyan { color: #00ccff; font-size: 15px; font-weight: bold; }
.rep-green { color: #00ff66; font-size: 15px; font-weight: bold; }
.rep-orange { color: #ffaa00; font-size: 15px; font-weight: bold; }

/* Summary Panel */
.rep-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rep-group-box { border: 1px solid #3f3f46; border-radius: 4px; position: relative; margin: 4px; padding: 12px 6px 6px 6px; }
.rep-group-title { position: absolute; top: -10px; left: 8px; background: #252526; padding: 0 4px; color: white; font-size: 13px; font-weight: bold; }
.rep-sum-row { display: flex; justify-content: space-between; align-items: center; margin: 2px 6px; }
.rep-sum-row span { color: gray; font-size: 13px; }
.rep-sum-row strong { font-size: 14px; }
#TxtTotalCount { color: white; }

/* DataGrid */
.rep-grid-wrap { flex: 1; min-height: 0; border: 1px solid #3e3e42; overflow-y: auto; background: #1e1e1e; position: relative; }
.rep-table { width: 100%; border-collapse: collapse; text-align: center; }
.rep-table th { background: #007acc; color: white; font-weight: bold; height: 32px; padding: 0; position: sticky; top: 0; z-index: 1; border-right: 1px solid #1e1e1e; }
.rep-table td { padding: 8px 4px; color: white; border-bottom: 1px solid #3e3e42; }
.rep-table tbody tr { background: #252526; }
.rep-table tbody tr:nth-child(even) { background: #2d2d30; }



.connection-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}
.connection-status.online {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.connection-status.offline {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

@media (max-width: 768px) {
  .rep-summary-grid {
    grid-template-columns: 1fr;
  }
}
