:root {
  color-scheme: light;
  font-family: Arial, "Noto Sans KR", sans-serif;
  background: #f5f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dfe5ef;
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.status-pill {
  border: 1px solid #cfd8e6;
  border-radius: 999px;
  color: #42526b;
  font-size: 13px;
  padding: 6px 10px;
}

.content {
  margin: 0 auto;
  max-width: 1040px;
  padding: 32px 20px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 20px;
}

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

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

.section-heading h2 {
  margin: 0;
}

.panel p {
  color: #5b667a;
  line-height: 1.5;
  margin: 0 0 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  color: #42526b;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.form input {
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  color: #172033;
  font-size: 15px;
  min-height: 40px;
  padding: 0 10px;
}

.form .check-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  font-weight: 700;
}

.form .check-row input {
  min-height: auto;
  padding: 0;
  width: auto;
}

.kv {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: minmax(120px, 180px) 1fr;
  margin: 0;
}

.kv dt {
  color: #5b667a;
  font-weight: 700;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

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

th,
td {
  border-bottom: 1px solid #dfe5ef;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #42526b;
  font-size: 13px;
}

.metadata-cell {
  max-width: 420px;
  overflow-wrap: anywhere;
}

button,
.link-button {
  align-items: center;
  background: #175cd3;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

button.secondary,
.link-button.secondary {
  background: #eef2f8;
  color: #253858;
}

button.outline,
.link-button.outline {
  background: #ffffff;
  border: 1px solid #98a2b3;
  color: #253858;
}

button.danger {
  background: #b42318;
}

button.compact {
  font-size: 12px;
  min-height: 30px;
  padding: 0 10px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
}

.status-badge.success {
  background: #dcfae6;
  color: #067647;
}

.status-badge.warning {
  background: #fff4d6;
  color: #9a5b00;
}

.status-badge.error {
  background: #fee4e2;
  color: #b42318;
}

.muted {
  color: #667085;
  font-size: 12px;
  margin-top: 4px;
}

.reader-shell {
  background: #101828;
  border-radius: 8px;
  overflow: hidden;
  padding: 12px;
}

.qr-panel {
  align-items: center;
  display: flex;
  justify-content: center;
  margin-top: 16px;
  min-height: 380px;
}

.qr-display-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  position: relative;
}

.qr-display {
  align-items: center;
  background: #ffffff;
  border: 16px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  display: flex;
  justify-content: center;
  min-height: 352px;
  min-width: 352px;
  position: relative;
}

.qr-display img,
.qr-display canvas {
  display: block;
  height: 320px;
  width: 320px;
}

.qr-logo-overlay {
  align-items: center;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.16);
  display: flex;
  height: 72px;
  justify-content: center;
  left: 50%;
  padding: 8px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  z-index: 2;
}

.qr-logo-overlay img {
  display: block;
  max-height: 52px;
  max-width: 52px;
  object-fit: contain;
}

.logo-preview {
  align-items: center;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
}

.logo-preview img {
  background: #ffffff;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  height: 56px;
  object-fit: contain;
  padding: 6px;
  width: 56px;
}

#qr-reader {
  background: #000000;
  border-radius: 6px;
  min-height: 320px;
}

#scan-reader {
  background: #000000;
  border-radius: 6px;
  min-height: 320px;
}

.log {
  background: #101828;
  border-radius: 8px;
  color: #d0d5dd;
  font-family: Consolas, monospace;
  font-size: 13px;
  min-height: 160px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.notice {
  background: #fff7e6;
  border: 1px solid #fedf89;
  border-radius: 8px;
  color: #7a4b00;
  margin-bottom: 16px;
  padding: 12px;
}

.success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.error {
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

.warning {
  background: #fff7e6;
  border-color: #fedf89;
  color: #7a4b00;
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
  }

  .content {
    padding: 20px 12px;
  }

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