:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #18212f;
  --muted: #637083;
  --border: #d9e0e7;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --danger: #c2410c;
  --success: #15803d;
  --shadow: 0 10px 24px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--primary);
  text-decoration: none;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #ffffff;
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 700;
  min-height: 36px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #22c55e;
  color: #052e16;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.nav a {
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.user-area,
.actions,
.inline-actions,
.form-actions,
.toolbar,
.compact-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-area form,
.actions form,
.inline-actions form {
  margin: 0;
}

.panel,
.stat,
.login-panel,
.public-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.panel.narrow {
  max-width: 720px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
}

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

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

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

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
}

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

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}

.checks {
  display: grid;
  gap: 10px;
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
}

.check-line input {
  width: auto;
  margin-top: 4px;
}

.check-line small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
}

.button.ghost {
  background: #ffffff;
}

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

.button.full {
  width: 100%;
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: var(--success);
  font-weight: 700;
}

.flash.error {
  background: #fff7ed;
  border-color: #fed7aa;
  color: var(--danger);
}

.flash.floating {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 10;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.empty {
  margin: 0;
  color: var(--muted);
  padding: 28px 0;
  text-align: center;
}

.pill {
  display: inline-flex;
  margin: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.detail-grid.single {
  grid-template-columns: 1fr;
}

.detail-grid div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

dd {
  margin: 5px 0 0;
}

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

.qr-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.qr-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid var(--border);
}

.truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-page,
.public-page,
.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel,
.public-panel {
  width: min(460px, 100%);
  padding: 28px;
}

.login-brand {
  color: var(--text);
  margin-bottom: 24px;
}

.error-page {
  text-align: center;
}

.error-page h1 {
  font-size: 64px;
}

code {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 5px;
}

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

  .sidebar {
    position: static;
    padding: 16px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    margin-top: 16px;
  }

  .nav a {
    white-space: nowrap;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 520px) {
  h1 {
    font-size: 24px;
  }

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

  .qr-card {
    grid-template-columns: 1fr;
  }
}

