* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f3f4f6;
  color: #202124;
  font-family: Arial, "Segoe UI", sans-serif;
  font-size: 16px;
}

.page-header {
  padding: 22px 28px;
  background: #ffffff;
  border-bottom: 1px solid #d6d9de;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
}

.page-header p {
  margin: 0;
  color: #5f6368;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: #ffffff;
  border: 1px solid #d6d9de;
  border-radius: 6px;
  padding: 18px;
}

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

h2 {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 700;
}

.state-row,
.check-grid div,
.measure-grid div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #eceff3;
}

.state-row:last-child,
.check-grid div:last-child,
.measure-grid div:last-child { border-bottom: none; }

.state-row span,
.check-grid span,
.measure-grid span {
  color: #5f6368;
}

.state-row strong,
.check-grid strong,
.measure-grid strong {
  text-align: right;
  font-weight: 700;
}

.measure-grid,
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
}

.status-ok { color: #1e7e34; }
.status-alarm { color: #b00020; }
.status-wait { color: #5f6368; }

.alarm-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.alarm-list li {
  padding: 9px 10px;
  border: 1px solid #d6d9de;
  border-radius: 4px;
  background: #f8f9fa;
  color: #5f6368;
}

.alarm-list li.on {
  background: #fde8e8;
  border-color: #f2b8b5;
  color: #b00020;
  font-weight: 700;
}

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

.section-title h2 { margin: 0; }
.section-title span { color: #5f6368; }

.pagination-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e1e4e8;
}

.pagination-info {
  font-size: 14px;
  color: #5f6368;
}

.pagination-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pagination-nav button {
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #d6d9de;
  border-radius: 4px;
  background: #fff;
  color: #202124;
  cursor: pointer;
}

.pagination-nav button:hover:not(:disabled) {
  background: #f1f3f4;
}

.pagination-nav button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-nav button.page-current {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #174ea6;
  font-weight: 700;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid #e1e4e8;
  text-align: left;
}

td {
  white-space: nowrap;
}

th {
  background: #f8f9fa;
  font-weight: 700;
  white-space: normal;
}
tr.alarm-row td { background: #fff3f3; }

.seq-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #1a73e8;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.seq-link:hover { color: #1557b0; }

body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 33, 36, 0.45);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 900px);
  overflow: auto;
  background: #fff;
  border: 1px solid #d6d9de;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  padding: 20px 44px 20px 20px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 4px;
  background: #f1f3f4;
  color: #202124;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover { background: #e8eaed; }

.modal-title {
  margin: 0 0 16px;
  padding-right: 8px;
  font-size: 20px;
  font-weight: 700;
}

.detail-section { margin-bottom: 18px; }

.detail-section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #202124;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid #eceff3;
  font-size: 14px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: #5f6368;
  flex: 1;
  min-width: 0;
}

.detail-value {
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
}

pre {
  background: #f8f9fa;
  border: 1px solid #d6d9de;
  padding: 12px;
  overflow-x: auto;
  max-height: 360px;
  font-size: 13px;
}

details { margin-top: 14px; }
summary { cursor: pointer; color: #1a73e8; }

@media (max-width: 780px) {
  .container { grid-template-columns: 1fr; padding: 12px; }
  .measure-grid, .check-grid { grid-template-columns: 1fr; }
  .alarm-list { grid-template-columns: 1fr; }
}
