:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #667381;
  --line: #dce3e8;
  --accent: #176f80;
  --accent-soft: #e7f4f6;
  --danger: #bd3434;
}

* { box-sizing: border-box; }

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

button,
input { font: inherit; }

.dashboard {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 64px;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 { margin: 0; }

h1 {
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.04em;
}

h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.lead,
.panel-description {
  color: var(--muted);
  line-height: 1.6;
}

.lead {
  max-width: 680px;
  margin: 12px 0 0;
}

.server-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #9ac8ae;
  border-radius: 999px;
  color: #176238;
  background: #eaf7ee;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.server-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e9b58;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.summary-card,
.device-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(20, 40, 55, 0.04);
}

.summary-card {
  min-height: 108px;
  padding: 20px;
}

.label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong { font-size: 21px; }

.notice {
  min-height: 44px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid #bddce2;
  border-radius: 10px;
  color: #245664;
  background: #eef8fa;
  font-size: 14px;
}

.notice[data-type="success"] {
  border-color: #acd5b9;
  color: #23663a;
  background: #eef9f1;
}

.notice[data-type="error"] {
  border-color: #e7b5b5;
  color: #923030;
  background: #fff1f1;
}

.device-panels {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.device-panel { padding: 22px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-description {
  margin: 8px 0 18px;
  font-size: 14px;
}

.secondary-button,
.danger-button,
.device-row button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.danger-button {
  border-color: var(--danger);
  color: #fff;
  background: var(--danger);
}

.device-row button {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.device-list {
  display: grid;
  gap: 9px;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}

.device-identity {
  display: grid;
  gap: 4px;
}

.device-identity strong { font-size: 16px; }

.device-identity small,
.empty-text {
  color: var(--muted);
  font-size: 13px;
}

.model-badge {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.device-check {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.device-check input {
  width: 19px;
  height: 19px;
  margin: 0;
}

.agency-field {
  display: grid;
  flex: 1;
  gap: 5px;
  max-width: 390px;
  min-width: 220px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agency-field input {
  width: 100%;
  min-height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}

.agency-field input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 111, 128, 0.13);
}

.empty-text { margin: 8px 0; }

@media (max-width: 760px) {
  .dashboard-header,
  .panel-header,
  .device-row {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid { grid-template-columns: 1fr; }
  .agency-field { max-width: none; min-width: 0; }
  .server-status { align-self: flex-start; }
}
