/* CAS Site Bridge - phone-style inverter view (v1.7) */
.iv-phone {
  --iv-green: #0b6b4f;
  --iv-green-soft: #e3f1ec;
  --iv-amber: #b26b00;
  --iv-amber-soft: #fdf1dc;
  --iv-red: #c0392b;
  --iv-red-soft: #fbe6e3;
  --iv-grey: #6b7280;
  --iv-line: #e5e7eb;
  --iv-bg: #f6f8f7;
  max-width: 460px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--iv-line);
  border-radius: 22px;
  box-shadow: 0 6px 24px rgba(15, 40, 30, 0.08);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.iv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 6px;
  background: linear-gradient(180deg, var(--iv-green-soft), #fff);
}
.iv-model { font-size: 17px; font-weight: 700; color: #111827; }
.iv-sn { font-size: 12px; color: var(--iv-grey); font-family: ui-monospace, Consolas, monospace; }
.iv-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.iv-status-ok { background: var(--iv-green-soft); color: var(--iv-green); }
.iv-status-warn { background: var(--iv-amber-soft); color: var(--iv-amber); }
.iv-status-bad { background: var(--iv-red-soft); color: var(--iv-red); }
.iv-status-idle { background: #eef0f3; color: #4b5563; }
.iv-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }
.iv-dot-ok { color: var(--iv-green); }
.iv-dot-warn { color: var(--iv-amber); }
.iv-dot-bad { color: var(--iv-red); }
.iv-dot-idle { color: #9ca3af; }
.iv-meta { display: flex; gap: 10px; padding: 0 18px; font-size: 11px; color: var(--iv-grey); }
.iv-meta-warn { color: var(--iv-amber); font-weight: 600; }

.iv-flow { display: block; width: 100%; height: auto; padding: 6px 8px 0; box-sizing: border-box; }
.iv-flow-line { stroke: #cbd5d1; stroke-width: 3; fill: none; stroke-dasharray: 6 6; }
.iv-flow-live { stroke: var(--iv-green); animation: iv-dash 0.9s linear infinite; }
@keyframes iv-dash { to { stroke-dashoffset: -12; } }
.iv-node { fill: #fff; stroke-width: 2.5; }
.iv-node-pv { stroke: #d69e00; }
.iv-node-inv { stroke: var(--iv-green); }
.iv-node-grid { stroke: #3b6fb6; }
.iv-ico path, .iv-ico rect { fill: none; stroke: #374151; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iv-node-label { font-size: 11px; fill: var(--iv-grey); font-weight: 600; }
.iv-flow-val { font-size: 14px; font-weight: 700; fill: #111827; }
.iv-flow-main { font-size: 17px; fill: var(--iv-green); }
.iv-flow-cap { font-size: 10px; fill: var(--iv-grey); }

.iv-gauge { padding: 4px 18px 12px; }
.iv-gauge-bar { height: 8px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.iv-gauge-bar span { display: block; height: 100%; background: var(--iv-green); border-radius: 999px; }
.iv-gauge-txt { display: flex; gap: 6px; align-items: baseline; font-size: 12px; color: var(--iv-grey); margin-top: 5px; }
.iv-gauge-txt strong { color: #111827; font-size: 13px; }

.iv-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--iv-line); border-top: 1px solid var(--iv-line); border-bottom: 1px solid var(--iv-line); }
.iv-kpi { background: #fff; padding: 12px 16px; }
.iv-kpi-val { font-size: 20px; font-weight: 700; color: #111827; }
.iv-kpi-val small { font-size: 12px; font-weight: 500; color: var(--iv-grey); margin-left: 4px; }
.iv-kpi-lbl { font-size: 12px; color: var(--iv-grey); margin-top: 2px; }

.iv-tabs { display: flex; overflow-x: auto; background: var(--iv-bg); border-bottom: 1px solid var(--iv-line); }
.iv-tab {
  flex: 1 0 auto; border: 0; background: none; padding: 11px 12px; font-size: 13px; font-weight: 600;
  color: var(--iv-grey); cursor: pointer; border-bottom: 2px solid transparent; position: relative;
}
.iv-tab.is-active { color: var(--iv-green); border-bottom-color: var(--iv-green); background: #fff; }
.iv-badge { display: inline-block; margin-left: 5px; min-width: 16px; padding: 0 5px; border-radius: 999px; background: var(--iv-red); color: #fff; font-size: 10px; line-height: 16px; }
.iv-pane { padding: 10px 16px 16px; min-height: 140px; }

.iv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.iv-table th { text-align: left; border-bottom: 1px solid var(--iv-line); padding: 0; }
.iv-th { width: 100%; text-align: left; border: 0; background: none; padding: 8px 6px; font-size: 12px; font-weight: 700; color: var(--iv-grey); cursor: pointer; }
.iv-table td { padding: 8px 6px; border-bottom: 1px solid #f1f3f5; vertical-align: middle; }
.iv-num { font-family: ui-monospace, Consolas, monospace; }
.iv-bar { height: 4px; background: #eef0f3; border-radius: 999px; margin-top: 4px; overflow: hidden; }
.iv-bar span { display: block; height: 100%; background: #d69e00; }

.iv-rows { margin-top: 6px; }
.iv-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid #f1f3f5; font-size: 13px; }
.iv-row span { color: var(--iv-grey); }
.iv-row strong { color: #111827; font-weight: 600; text-align: right; font-family: ui-monospace, Consolas, monospace; }

.iv-phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.iv-phase { background: var(--iv-bg); border-radius: 12px; padding: 10px; text-align: center; }
.iv-phase-name { font-size: 12px; font-weight: 700; color: var(--iv-green); }
.iv-phase-v { font-size: 16px; font-weight: 700; color: #111827; margin-top: 2px; }
.iv-phase-a { font-size: 12px; color: var(--iv-grey); }

.iv-alarms { list-style: none; margin: 0; padding: 0; }
.iv-alarms li { display: flex; align-items: center; gap: 8px; padding: 9px 2px; border-bottom: 1px solid #f1f3f5; font-size: 13px; color: var(--iv-red); }
.iv-ok-big { text-align: center; padding: 28px 0; color: var(--iv-green); font-weight: 700; }
.iv-empty { text-align: center; padding: 28px 0; color: var(--iv-grey); }

/* v1.7 editable settings */
.iv-sec { margin-top: 10px; }
.iv-sec-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--iv-green); padding: 6px 2px; }
.iv-th-plain { padding: 8px 6px; font-size: 12px; font-weight: 700; color: var(--iv-grey); }
.iv-set-table td { vertical-align: top; }
.iv-edit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.iv-input { min-width: 0; width: 96px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; background: #fff; }
select.iv-input { width: 150px; }
.iv-input:focus { outline: 2px solid var(--iv-green-soft); border-color: var(--iv-green); }
.iv-btn { border: 1px solid #d1d5db; background: #fff; color: #111827; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.iv-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.iv-btn-primary { background: var(--iv-green); border-color: var(--iv-green); color: #fff; }
.iv-btn-danger { background: var(--iv-red); border-color: var(--iv-red); color: #fff; }
.iv-invalid { font-size: 11px; color: var(--iv-red); margin-top: 3px; }
.iv-chip { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.iv-chip-ok { background: var(--iv-green-soft); color: var(--iv-green); }
.iv-chip-bad { background: var(--iv-red-soft); color: var(--iv-red); }
.iv-chip-warn { background: var(--iv-amber-soft); color: var(--iv-amber); margin-top: 0; }
.iv-lock { vertical-align: -1px; }
.iv-lock rect, .iv-lock path { fill: none; stroke: var(--iv-grey); stroke-width: 1.5; }
.iv-confirm { border: 1px solid var(--iv-green); background: var(--iv-green-soft); border-radius: 14px; padding: 10px 12px; margin: 6px 0 10px; }
.iv-confirm-danger { border-color: var(--iv-red); background: var(--iv-red-soft); }
.iv-confirm-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.iv-confirm .iv-row { border-bottom-color: rgba(0, 0, 0, 0.06); }
.iv-confirm-sn { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--iv-grey); padding: 8px 2px; }
.iv-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { .iv-flow-live { animation: none; } }

/* v1.16.6 live monitoring badge + manual refresh icon */
.iv-meta { align-items: center; }
.iv-live { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.iv-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--iv-grey); }
.iv-live.is-live { color: var(--iv-green); }
.iv-live.is-live .iv-live-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
.iv-live.is-paused { color: var(--iv-grey); }
.iv-refresh { margin-left: auto; border: 1px solid rgba(0, 0, 0, 0.12); background: #fff; border-radius: 999px; width: 26px; height: 26px; line-height: 22px; font-size: 14px; color: var(--iv-grey); cursor: pointer; padding: 0; }
.iv-refresh:hover { color: var(--iv-green); border-color: var(--iv-green); }
/* Yes / No confirm block */
.iv-confirm h4 { margin: 0 0 6px; font-size: 15px; }
.cm-confirm-line { font-size: 15px; margin: 4px 0 8px; }
.iv-confirm-actions .iv-btn { min-width: 96px; min-height: 40px; }
.cm-na { color: var(--iv-grey); }
