/* 신세계 컬러: PANTONE 485C(레드), PANTONE 431C(그레이) */
:root {
  --brand: #da291c;
  --gray: #5b6770;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #fff;
  color: #111;
  font: 16px/1.5 "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

.desk main {
  max-width: 1080px;
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.3;
}

h2 {
  margin: 28px 0 14px;
  padding-top: 20px;
  border-top: 1px solid #ddd;
  color: var(--gray);
  font-size: 14px;
}

p {
  margin: 0 0 12px;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.site {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
}

.lead {
  color: var(--gray);
}

.note,
.muted {
  color: var(--gray);
  font-size: 14px;
  font-weight: 400;
}

.optional {
  color: #888;
  font-size: 14px;
  font-weight: 400;
}

.center {
  text-align: center;
}

/* 입력 */

.field {
  display: block;
  margin: 0 0 18px;
  font-weight: 600;
}

fieldset.field {
  min-width: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  padding: 0;
}

.field input:not([type="radio"], [type="checkbox"]),
.field select {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid #999;
  border-radius: 4px;
  background: #fff;
  font-weight: 400;
}

.field input::-webkit-date-and-time-value {
  text-align: left;
}

.pair {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 12px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-weight: 400;
}

.choices label {
  position: relative;
}

.choices label:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.choices input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choices span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 4px 8px;
  border: 1px solid #999;
  border-radius: 4px;
  text-align: center;
}

.choices input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.choices input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.terms {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 4px;
  background: #f3f3f3;
  font-size: 14px;
  font-weight: 400;
}

.terms dt {
  color: var(--gray);
}

.terms dd {
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--brand);
}

.sig-pad {
  position: relative;
  border: 1px solid #999;
  border-radius: 4px;
}

.sig-pad::before {
  content: "여기에 서명";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #bbb;
  font-weight: 400;
  pointer-events: none;
}

.sig-pad.signed::before {
  content: none;
}

#sig {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.sig-tools {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 8px 0 0;
  font-weight: 400;
}

.sig-tools .error-text {
  margin-right: auto;
}

/* 버튼, 알림 */

.primary {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px;
  border: 0;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.button {
  display: block;
  padding: 12px;
  border: 1px solid var(--brand);
  border-radius: 4px;
  color: var(--brand);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gray);
  font-size: 14px;
  text-decoration: underline;
}

.error {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-left: 3px solid #b00020;
  background: #fdf2f3;
  color: #8a0018;
}

.error p,
.error ul {
  margin: 0;
}

.error ul {
  padding-left: 18px;
}

.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 3px solid #0a6b2d;
  background: #eef7f1;
  color: #0a6b2d;
  font-weight: 600;
}

.error-text {
  color: #b00020;
}

.warn {
  color: #a34700;
}

/* 출입 QR */

.pass {
  margin: 16px 0;
  padding: 20px 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  text-align: center;
}

.qr svg {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0 auto;
}

.code {
  margin: 8px 0 2px;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.pass-status {
  font-weight: 600;
}

.summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid #e5e5e5;
  text-align: left;
}

.summary dt {
  color: var(--gray);
}

.summary dd {
  margin: 0;
}

/* 보안실 */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 10px 16px;
  border-bottom: 1px solid #ddd;
}

.brand {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.search {
  display: flex;
  flex: 1 1 280px;
  min-width: 0;
  gap: 6px;
  max-width: 560px;
}

.search input,
.inline input {
  height: 42px;
  padding: 0 10px;
  border: 1px solid #999;
  border-radius: 4px;
  background: #fff;
}

.search input {
  flex: 1;
  width: 0; /* 글자가 커도 입력칸이 줄어들어 버튼이 밀려나지 않게 */
  min-width: 0;
}

.search button,
.inline button {
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--brand);
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
}

.search .secondary {
  background: #fff;
  color: var(--brand);
}

#scanner {
  width: min(480px, calc(100% - 32px));
  padding: 16px;
  border: 0;
  border-radius: 6px;
}

#scanner::backdrop {
  background: rgb(0 0 0 / 0.6);
}

#scanner video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #000;
  object-fit: cover;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  font-size: 14px;
}

.bar nav form {
  margin: 0;
}

.bar .link {
  color: inherit;
}

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

.toolbar h1 {
  margin: 0;
}

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

.counts {
  color: var(--gray);
}

.table-wrap {
  margin: 0 -16px 24px;
  padding: 0 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--gray);
  font-size: 13px;
  font-weight: 600;
}

td a {
  font-weight: 600;
}

tr.out td {
  color: #888;
}

.st {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
}

.st.in,
.pass-status.in {
  color: #0a6b2d;
}

.st.wait,
.pass-status.wait {
  color: var(--gray);
}

.st.out,
.pass-status.out {
  color: #888;
}

.st.miss,
.pass-status.miss {
  color: #a34700;
}

.empty {
  padding: 32px 0;
  color: #777;
  text-align: center;
}

.export {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
  color: var(--gray);
  font-size: 14px;
}

.export span {
  flex-basis: 100%;
}

.back {
  font-size: 14px;
}

.visit {
  max-width: 560px;
}

.visit h1 {
  margin: 8px 0 16px;
  font-size: 26px;
}

.info {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 8px 16px;
  margin: 0 0 24px;
}

.info dt {
  color: var(--gray);
}

.info dd {
  margin: 0;
}

.sig {
  display: block;
  width: 100%;
  max-width: 300px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.action {
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.action .link {
  display: block;
  margin-top: 14px;
}

/* 등록 QR 포스터 */

.poster {
  max-width: 520px;
  margin: 24px auto;
  text-align: center;
}

.poster h1 {
  font-size: 28px;
}

.poster .qr svg {
  max-width: 320px;
}

.poster ol {
  display: inline-block;
  margin: 20px 0;
  padding-left: 22px;
  font-size: 18px;
  text-align: left;
}

.url {
  color: var(--gray);
  font-size: 14px;
}

.no-print {
  max-width: 320px;
  margin: 0 auto;
}

td.c-card {
  display: none;
}

/* 휴대폰: 머리글은 두 줄, 목록은 카드 */
@media (max-width: 640px) {
  .bar {
    gap: 8px 12px;
  }

  .bar nav {
    gap: 12px;
    font-size: 13px;
  }

  .search {
    flex-basis: 100%;
    order: 3;
    max-width: none;
  }

  .search button {
    padding: 0 12px;
  }

  .table-wrap {
    margin: 0 0 24px;
    padding: 0;
    overflow: visible;
  }

  table,
  tbody {
    display: block;
  }

  thead,
  td.c-wide {
    display: none;
  }

  tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 4px 10px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e5e5;
  }

  td {
    padding: 0;
    border: 0;
  }

  td.c-st {
    grid-row: 1;
    grid-column: 1;
  }

  td.c-name {
    grid-row: 1;
    grid-column: 2;
    font-size: 17px;
  }

  td.c-badge {
    grid-row: 1;
    grid-column: 3;
  }

  td.c-badge:not(:empty)::before {
    content: "출입증 ";
    color: var(--gray);
    font-size: 13px;
  }

  td.c-card {
    display: block;
    grid-column: 1 / -1;
    color: var(--gray);
    font-size: 14px;
    white-space: normal;
  }

  .info {
    grid-template-columns: 5rem 1fr;
  }
}

@media print {
  .bar,
  .no-print {
    display: none;
  }

  .poster {
    max-width: none;
    margin-top: 20mm;
  }

  .poster h1 {
    font-size: 30pt;
  }

  .poster .qr svg {
    max-width: 110mm;
  }

  .poster ol {
    font-size: 16pt;
  }
}
