:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-strong: #eef4f8;
  --text: #17202a;
  --muted: #667085;
  --line: #d7dee8;
  --primary: #1b4f72;
  --info: #2e86c1;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
}

body.dark {
  color-scheme: dark;
  --bg: #121826;
  --panel: #1f2937;
  --panel-strong: #273449;
  --text: #f3f6fb;
  --muted: #a7b1c2;
  --line: #3a4658;
  --primary: #2e86c1;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--bg);
}

.login-view.hidden {
  display: none;
}

.login-panel {
  width: min(390px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--text);
}

.login-panel h1 {
  font-size: 24px;
}

.login-panel button,
.text-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.login-error {
  min-height: 18px;
  margin-bottom: 0;
  color: var(--danger);
  font-size: 13px;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: var(--primary);
  color: #fff;
  padding: 20px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  font-size: 21px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #fff;
  color: var(--primary);
  border-radius: 6px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: #dceaf4;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.main {
  padding: 22px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

select,
input,
.status-pill,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

select {
  padding: 0 12px;
}

input {
  padding: 0 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 700;
}

.status-pill.online {
  color: var(--success);
}

.status-pill.offline {
  color: var(--danger);
}

.icon-button {
  width: 38px;
  cursor: pointer;
}

.site-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.view-section {
  display: none;
}

.summary-grid.view-section,
.dashboard-grid.view-section,
.dashboard-overview.view-section,
.dashboard-snapshot-grid.view-section,
.process-board.view-section,
.edge-grid.view-section,
.operations-grid.view-section,
.report-grid.view-section {
  display: none;
}

.view-section.active {
  display: grid;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.site-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--success);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.site-card.offline {
  border-left-color: var(--danger);
}

.site-card strong {
  display: block;
  margin-bottom: 6px;
}

.site-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-grid,
.dashboard-grid {
  display: grid;
  gap: 14px;
}

.dashboard-overview {
  gap: 0;
  margin-bottom: 14px;
}

.summary-grid {
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.8fr);
  margin-bottom: 14px;
}

.dashboard-grid {
  grid-template-columns: minmax(260px, 0.85fr) minmax(260px, 0.85fr) minmax(360px, 1.3fr);
  margin-bottom: 14px;
}

.dashboard-snapshot-grid {
  gap: 14px;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  margin-bottom: 14px;
}

.metric-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
}

.panel-header h2 {
  color: var(--text);
}

.process-flow {
  min-height: 250px;
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  align-items: center;
  gap: 10px;
}

.process-node {
  position: relative;
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-strong);
  text-align: center;
}

.process-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -11px;
  width: 12px;
  height: 2px;
  background: var(--info);
}

.process-node b {
  font-size: 14px;
}

.process-node span {
  color: var(--info);
  font-size: 22px;
  font-weight: 800;
}

.meter-list,
.tank-list,
.alarm-list {
  display: grid;
  gap: 10px;
}

.meter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.meter-row:last-child {
  border-bottom: 0;
}

.meter-row span,
.alarm-time,
.tank-meta {
  color: var(--muted);
  font-size: 13px;
}

.meter-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--info);
}

.compact-value {
  font-size: 22px;
}

/* Grouped flow-meter list — introduced with the 15-port IDRice migration. */
.meter-group {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.meter-group:first-child {
  padding-top: 0;
  border-top: none;
}
.meter-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-transform: uppercase;
}
.meter-group-title span {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

/* Ports view row states */
.port-ok td:first-child::before {
  color: var(--success, #27AE60);
}
/* 정지 = 설비 미가동(정상). 단절과 구분되도록 흐리게 하지 않는다. */
.port-idle td:first-child::before {
  color: var(--warning, #E6A417);
}
.port-off {
  opacity: 0.55;
}
.port-off td:first-child::before {
  color: var(--danger, #E74C3C);
}

.tank {
  display: grid;
  gap: 7px;
}

.tank-bar {
  height: 18px;
  border-radius: 4px;
  background: var(--panel-strong);
  overflow: hidden;
}

.tank-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--info));
}

.alarm-item {
  border-left: 4px solid var(--warning);
  border-radius: 4px;
  padding: 10px;
  background: var(--panel-strong);
}

.alarm-item.critical {
  border-left-color: var(--danger);
}

.ack-button,
.inventory-form button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.ack-button {
  margin-top: 8px;
  background: var(--info);
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  margin-top: 14px;
}

.edge-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.operations-grid.view-section.active,
.dashboard-snapshot-grid.view-section.active,
.edge-grid.view-section.active,
.report-grid.view-section.active {
  display: grid;
}

.summary-grid.view-section.active,
.dashboard-overview.view-section.active,
.process-board.view-section.active,
.dashboard-grid.view-section.active {
  display: grid;
}

.process-board {
  gap: 0;
}

.overall-process-map {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #dfe3e6;
  box-shadow: var(--shadow);
}

body.dark .overall-process-map {
  background: #1b2431;
}

.process-map-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 1080px;
  margin-bottom: 10px;
  border: 2px solid #b7c4ce;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f7fbfd;
  color: #188a31;
}

body.dark .process-map-title {
  background: var(--panel);
  color: #71d98b;
}

.process-map-title strong {
  font-size: 24px;
}

.process-map-title span {
  color: var(--muted);
  font-size: 13px;
}

.process-map-grid {
  position: relative;
  min-width: 1080px;
  min-height: 620px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, 86px);
  gap: 14px;
  border: 2px solid #b8c4cc;
  border-radius: 6px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    #d7dcdf;
  background-size: 90px 88px;
}

body.dark .process-map-grid {
  border-color: var(--line);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    #202a38;
  background-size: 90px 88px;
}

.pipe {
  position: absolute;
  z-index: 0;
  border-radius: 999px;
  opacity: 0.95;
}

.pipe-green {
  background: #28b463;
}

.pipe-blue {
  background: #2e86de;
}

.pipe-orange {
  background: #f39c12;
}

.pipe-purple {
  background: #8e44ad;
}

.pipe-a {
  left: 82px;
  top: 122px;
  width: 760px;
  height: 5px;
}

.pipe-b {
  left: 180px;
  top: 308px;
  width: 820px;
  height: 5px;
}

.pipe-c {
  left: 540px;
  top: 112px;
  width: 5px;
  height: 390px;
}

.pipe-d {
  left: 118px;
  top: 500px;
  width: 870px;
  height: 5px;
}

.process-equipment {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
  align-items: center;
  border: 2px solid #a6b4bd;
  border-radius: 4px;
  padding: 7px;
  background: #f4f6f7;
  box-shadow: 0 4px 10px rgba(20, 28, 38, 0.12);
}

body.dark .process-equipment {
  background: var(--panel);
  border-color: var(--line);
}

.equipment-vessel {
  width: 30px;
  height: 54px;
  border: 2px solid #98a6ad;
  border-radius: 8px 8px 14px 14px;
  background: linear-gradient(#fdfefe, #d5dbdb);
}

.process-equipment.hopper .equipment-vessel {
  clip-path: polygon(15% 0, 85% 0, 85% 60%, 60% 100%, 40% 100%, 15% 60%);
  border-radius: 2px;
}

.process-equipment.meter .equipment-vessel {
  border-color: #2e86de;
  background: linear-gradient(#ebf5fb, #aed6f1);
}

.process-equipment.machine .equipment-vessel {
  border-radius: 4px;
  background: linear-gradient(#f8f9f9, #95a5a6);
}

.process-equipment.quality .equipment-vessel,
.process-equipment.pack .equipment-vessel {
  border-color: #8e44ad;
  background: linear-gradient(#f5eef8, #d7bde2);
}

.process-equipment.alert {
  border-color: var(--danger);
}

.process-equipment.ok {
  border-color: var(--success);
}

.equipment-panel {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-radius: 4px;
  padding: 7px;
  background: linear-gradient(#515a5a, #1f2528);
  color: #fff;
}

.equipment-panel strong,
.equipment-panel span,
.equipment-panel b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-panel strong {
  font-size: 13px;
}

.equipment-panel span {
  color: #cfd8dc;
  font-size: 11px;
}

.equipment-panel b {
  color: #f7dc6f;
  font-size: 15px;
}

[data-equip="raw-a"] {
  grid-column: 1 / 3;
  grid-row: 1;
}

[data-equip="raw-b"] {
  grid-column: 1 / 3;
  grid-row: 3;
}

[data-equip="input-1"] {
  grid-column: 3 / 5;
  grid-row: 1;
}

[data-equip="input-2"] {
  grid-column: 3 / 5;
  grid-row: 3;
}

[data-equip="flow-1"] {
  grid-column: 5 / 7;
  grid-row: 1;
}

[data-equip="flow-2"] {
  grid-column: 5 / 7;
  grid-row: 3;
}

[data-equip="stone-1"] {
  grid-column: 7 / 9;
  grid-row: 1;
}

[data-equip="stone-2"] {
  grid-column: 7 / 9;
  grid-row: 3;
}

[data-equip="brown-1"] {
  grid-column: 9 / 11;
  grid-row: 1;
}

[data-equip="brown-2"] {
  grid-column: 9 / 11;
  grid-row: 3;
}

[data-equip="white-1"] {
  grid-column: 11 / 13;
  grid-row: 1;
}

[data-equip="white-2"] {
  grid-column: 11 / 13;
  grid-row: 3;
}

[data-equip="quality"] {
  grid-column: 6 / 8;
  grid-row: 5;
}

[data-equip="pack-1"] {
  grid-column: 9 / 11;
  grid-row: 5;
}

[data-equip="pack-2"] {
  grid-column: 11 / 13;
  grid-row: 5;
}

[data-equip="alarm"] {
  grid-column: 1 / 3;
  grid-row: 5;
}

.process-legend {
  min-width: 1080px;
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.process-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.process-legend i {
  width: 20px;
  height: 5px;
  border-radius: 999px;
}

.legend-green {
  background: #28b463;
}

.legend-blue {
  background: #2e86de;
}

.legend-orange {
  background: #f39c12;
}

.legend-purple {
  background: #8e44ad;
}

.wide-panel {
  grid-column: 1 / -1;
}

.report-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.report-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.report-summary.compact {
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  margin-bottom: 0;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel-strong);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.inventory-list {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.inventory-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.inventory-row:last-child {
  border-bottom: 0;
}

.inventory-row strong {
  display: block;
}

.inventory-form {
  display: grid;
  grid-template-columns: 1fr 90px 100px minmax(120px, 1fr) 72px;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-list {
  display: grid;
  gap: 10px;
}

.edge-device-list,
.process-steps,
.checklist-grid {
  display: grid;
  gap: 10px;
}

.edge-register-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.edge-register-form input:nth-child(3),
.edge-register-form input:nth-child(5),
.edge-register-form button {
  grid-column: 1 / -1;
}

.edge-register-form button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.key-output {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.key-output code {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: var(--panel-strong);
  color: var(--text);
}

.config-snippet {
  min-height: 250px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.edge-device-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 5px solid var(--success);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-strong);
}

.edge-device-card.offline {
  border-left-color: var(--danger);
}

.edge-device-card span,
.edge-device-card small,
.process-step span,
.check-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.edge-device-metrics {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.process-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.process-step b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
}

.checklist-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.check-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel-strong);
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-row span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td:nth-child(3) {
  color: var(--info);
  font-weight: 800;
}

canvas {
  width: 100%;
  height: 260px;
  display: block;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 14px;
    max-width: 100vw;
    overflow: hidden;
  }

  .sidebar .brand {
    height: 36px;
    font-size: 18px;
  }

  .nav-list {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    margin-top: 10px;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .summary-grid,
  .dashboard-grid,
  .dashboard-snapshot-grid,
  .edge-grid,
  .operations-grid,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .report-summary.compact {
    grid-template-columns: 1fr;
  }

  .process-flow {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .process-node::after {
    display: none;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .meter-value {
    font-size: 28px;
  }

  .inventory-form {
    grid-template-columns: 1fr 1fr;
  }

  .inventory-form input:last-of-type,
  .inventory-form button {
    grid-column: span 2;
  }
}

/* ==========================================================================
 * 공정전체 (RICE.bmp SVG re-creation)
 * ========================================================================== */
/* 헤더 — 현재 로그인 계정·권한 표시 */
.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.14);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* 공정보드: SVG 스크롤 영역 + 우측 하단 고정 버튼의 기준 컨테이너 */
.process-board {
  position: relative;
}

.process-svg-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  background: #e5e2c8;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 공정전체 우측 하단 — 포장기 5대 표시 전환.
   스크롤 영역 밖(.process-board 기준)이라 가로 스크롤과 무관하게 항상 같은 자리. */
.packing-toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1.5px solid #8a8560;
  border-radius: 999px;
  background: #fbfaf2;
  color: #55523c;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.packing-toggle:hover {
  background: #fff;
  transform: translateY(-1px);
}
.packing-toggle:active { transform: translateY(0); }
.packing-toggle:focus-visible {
  outline: 2px solid #1c7ed6;
  outline-offset: 2px;
}
.packing-toggle.on {
  background: #1c7ed6;
  border-color: #1864ab;
  color: #fff;
}
.process-svg {
  width: 100%;
  height: auto;
  min-width: 1400px;    /* keep readable on narrow screens */
  display: block;
}
.silo-node:hover rect,
.silo-node:hover path {
  filter: brightness(1.1);
}
.silo-node:hover text {
  fill: #145a92;
}

.process-legend {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: #555;
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-tip {
  margin-left: auto;
  color: #888;
  font-style: italic;
}

/* Silo manual-entry modal */
.silo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: modal-in 0.15s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.silo-modal {
  background: #ffffff;
  color: #1a2036;
  border-radius: 10px;
  padding: 22px 26px;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
}
body.dark .silo-modal {
  background: #1f2740;
  color: #e0e6f5;
}
.silo-modal h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.silo-modal h3 small {
  color: #888;
  font-size: 12px;
  margin-left: 6px;
}
.silo-modal-hint {
  color: #666;
  font-size: 12px;
  margin: 0 0 14px;
}
.silo-modal form {
  display: grid;
  gap: 12px;
}
.silo-modal label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #555;
}
body.dark .silo-modal label {
  color: #a8b3cc;
}
.silo-modal input,
.silo-modal select {
  padding: 8px 10px;
  border: 1px solid #c0c8d5;
  border-radius: 5px;
  font-size: 14px;
  background: #fff;
  color: #1a2036;
}
body.dark .silo-modal input,
body.dark .silo-modal select {
  background: #10162a;
  color: #e0e6f5;
  border-color: #3a4260;
}
.silo-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.primary-button {
  background: #1a75c3;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}
.primary-button:hover { background: #1d84dc; }

/* History / Report charts */
#history-graph-wrap,
#report-chart-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 8px 0;
}
#history-canvas,
#report-canvas {
  width: 100%;
  min-width: 720px;
  height: auto;
  display: block;
}
.text-button.active {
  background: var(--info, #2E86C1);
  color: #fff;
  border-radius: 5px;
}

/* 재고 메뉴 — 사일로(탱크) 재고 섹션 */
.silo-stock-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.silo-stock-group {
  border: 1px solid rgba(140, 150, 170, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(140, 150, 170, 0.05);
}
.silo-stock-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(140, 150, 170, 0.3);
}
.silo-stock-head strong {
  font-size: 14px;
}
.silo-stock-head span {
  font-size: 12px;
  color: var(--muted, #8894a8);
}
.silo-stock-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 3px 0;
}
.silo-stock-row em {
  color: var(--success, #27AE60);
  font-style: normal;
  font-size: 11px;
}
.silo-stock-row.muted span,
.silo-stock-row.muted strong {
  color: var(--muted, #8894a8);
  font-weight: 400;
}

/* 삭제(정정) 버튼 */
.del-btn {
  background: transparent;
  border: 1px solid var(--danger, #E74C3C);
  color: var(--danger, #E74C3C);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.del-btn:hover { background: var(--danger, #E74C3C); color: #fff; }

/* 원격 업데이트 패널 (엣지 메뉴) */
.edge-update-panel .report-summary { margin-bottom: 10px; }
.edge-update-panel code {
  background: rgba(127,127,127,0.15);
  padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.edge-update-panel button { margin-top: 6px; }

/* 미설치 포트 — 배선하지 않은 포트를 '단절'과 구분 (장애가 아님) */
.port-unused { opacity: 0.45; }
.port-unused td:first-child::before { color: var(--muted); }

/* 패널 상단 안내문 (에이전트 설치파일 등) */
.panel-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.panel-hint code {
  background: rgba(127,127,127,0.15);
  padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
/* SHA-256 은 64자라 좁은 화면에서 넘친다 */
#agent-package-panel code { word-break: break-all; }

/* 인증키 재발급 결과 — 평문 키는 한 번만 표시되므로 눈에 띄게 */
.edge-key-result {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(230, 164, 23, 0.5);
  border-left: 3px solid #e6a417;
  border-radius: 4px;
  background: rgba(230, 164, 23, 0.08);
}
.edge-key-result strong { display: block; font-size: 13px; margin-bottom: 6px; }
.edge-key-result code {
  display: block;
  margin-bottom: 8px;
  padding: 8px 10px;
  font-size: 13px;
  word-break: break-all;
  user-select: all;
  background: rgba(127,127,127,0.15);
  border-radius: 4px;
}
.edge-key-result p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.edge-key-actions { display: flex; gap: 8px; }
.edge-key-actions button {
  font-size: 12px; padding: 4px 10px; cursor: pointer;
  border: 1px solid rgba(127,127,127,0.4); border-radius: 4px;
  background: transparent; color: inherit;
}
