/* Single source of colors, type sizes and spacing (docs/설계.md 3). */
/* Design v2 C "zero-trust security" (user decision 2026-11-26, design/direction-approved.md):
   a bright workspace for the sign app (glare, signature pad), cobalt for the one thing to
   press, 1px lines, 8px corners, verification values in a monospace face. */
:root {
  color-scheme: light dark;

  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #0B1120;
  --color-muted: #475569;
  --color-line: #B8C3D3;
  --color-line-soft: #D7DEE8;
  --color-accent: #2563EB;
  --color-accent-text: #ffffff;
  --color-ok: #059669;
  --color-error: #b91c1c;
  --color-warn-bg: #fef3c7;
  --color-warn-text: #92400e;
  --color-paper: #ffffff;
  --color-ink: #0B1120;
  /* The intro page's dark band. */
  --color-night: #0B1120;
  --color-night-2: #111A2E;
  --color-night-line: #22304A;
  --color-night-text: #E5ECF6;
  --color-night-muted: #94A3B8;
  --color-night-accent: #93B4F8;

  /* Pretendard, served by us (site/fonts.ts, SIL OFL 1.1). Before 2026-11-26 the list
     started with Noto Sans KR, which few phones and PCs have, so most saw Malgun Gothic. */
  --font-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  /* Sizes stay large for older workers; spacing and weight do the refining. */
  --font-size-body: 17px;
  --font-size-small: 15px;
  --font-size-title: 24px;
  --tracking-body: -0.01em;
  --tracking-title: -0.025em;
  --leading-body: 1.6;
  --leading-title: 1.3;
  --weight-strong: 700;
  /* Field labels sit under headings, not level with them. */
  --weight-label: 600;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --radius: 8px;
  --tap: 52px;
  --content-width: 640px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0B1120;
    --color-surface: #111A2E;
    --color-text: #E5ECF6;
    --color-muted: #94A3B8;
    --color-line: #34445F;
    --color-line-soft: #22304A;
    --color-accent: #3B82F6;
    --color-accent-text: #ffffff;
    --color-ok: #34D399;
    --color-error: #fca5a5;
    --color-warn-bg: #422006;
    --color-warn-text: #fde68a;
  }
}

body {
  /* Korean breaks between words, not inside them (experiment S5 rule). */
  word-break: keep-all;
  overflow-wrap: anywhere;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-weight: var(--weight-strong);
  line-height: var(--leading-title);
  letter-spacing: var(--tracking-title);
  text-wrap: balance;
}

/* Even line lengths in buttons; no lone word left on a paragraph's last line. */
button,
.button {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

/* Dates, phone numbers and counts line up digit by digit. */
input,
time,
.summary,
table {
  font-variant-numeric: tabular-nums;
}

.app {
  max-width: var(--content-width);
  margin: 0 auto;
  /* --ad-height: the app's bottom banner (platform/nativeAds.ts), 0 elsewhere. */
  padding: var(--space-2) 20px calc(var(--space-3) + var(--ad-height, 0px));
}

.step {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Each step sits on a card with its own inner margin, so fields and buttons do not run
   to the screen edges (phone check 2026-11-26: edge-to-edge looked dated). */
.step {
  background: var(--color-surface);
  border: 1px solid var(--color-line-soft);
  border-radius: 16px;
  padding: var(--space-3) 20px;
}

.step + .step {
  margin-top: var(--space-2);
}

.step h2 {
  font-size: var(--font-size-title);
  margin: 0;
}

.step h3 {
  margin: var(--space-1) 0 0;
}

button,
.button {
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-accent-text);
  font: inherit;
  font-weight: var(--weight-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-line);
}

/* Language button on top of every sign screen (user decision 2026-11-26). */
.lang-bar {
  display: flex;
  justify-content: flex-end;
}

button.small {
  min-height: auto;
  width: auto;
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-small);
}

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

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.row > button {
  flex: 1;
}

.choices {
  display: grid;
  gap: var(--space-1);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0;
  padding: 0;
  margin: 0;
}

.field input,
.date-part input {
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 18px;
  font-weight: 400;
}

.field input:focus,
.date-part input:focus {
  outline: none;
  border: 2px solid var(--color-accent);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 15%);
}

.field {
  font-weight: var(--weight-label);
}

.date-part {
  display: flex;
  flex-direction: column;
  flex: 1;
  font-size: var(--font-size-small);
}

/* 1983년 01월 15일: boxes sized to their digits, the unit after each box. */
.date-row.units-after {
  flex-wrap: nowrap;
  align-items: center;
}

.date-part.unit-after {
  flex-direction: row;
  align-items: center;
  flex: none;
  gap: var(--space-1);
  font-size: inherit;
}

.date-part.unit-after input {
  width: calc(var(--digits) * 1ch + 4 * var(--space-1));
  text-align: center;
}

.check {
  display: flex;
  gap: var(--space-1);
  align-items: flex-start;
  font-weight: 600;
}

.check input {
  flex: none;
  width: 24px;
  height: 24px;
  /* .field input gives text boxes a 52px tap height and padding; a checkbox keeps its own
     size and sits on the first line of its label (2026-11-26: boxes sat below the text). */
  min-height: 0;
  padding: 0;
  margin: calc((1lh - 24px) / 2) 0 0;
}

.hint,
.privacy,
.step-count,
.site {
  color: var(--color-muted);
  font-size: var(--font-size-small);
  margin: 0;
}

.error {
  color: var(--color-error);
  font-size: var(--font-size-small);
}

.notice,
.tag.warn {
  background: var(--color-warn-bg);
  color: var(--color-warn-text);
  border-radius: var(--radius);
  padding: 2px var(--space-1);
}

.tag {
  font-size: var(--font-size-small);
  font-weight: 600;
}

/* The signature pad is always white paper with black ink, also in dark mode. */
.signature-pad {
  width: 100%;
  aspect-ratio: 3 / 1;
  background: var(--color-paper);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  touch-action: none;
}

.mask-editor {
  width: 100%;
  height: auto;
  touch-action: none;
  border-radius: var(--radius);
}

.clauses,
.hazards {
  padding-left: var(--space-3);
  margin: 0;
}

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-line);
  margin-bottom: var(--space-2);
}

.admin-bar a {
  color: var(--color-accent);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 19px;
  white-space: nowrap;
}

/* On a phone the menu goes under the name instead of squeezing it. */
.admin-bar {
  flex-wrap: wrap;
}

.admin-bar nav a {
  text-decoration: none;
}

.admin-bar a[aria-current='page'] {
  font-weight: 700;
}

select,
.row input {
  min-height: var(--tap);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  padding: 0 var(--space-1);
}

/* The birth date boxes sit in a .row but are input fields like the others. */
.date-row input {
  background: var(--color-surface);
}

.row input {
  flex: 1;
}

.qr {
  image-rendering: pixelated;
  align-self: center;
}

.qr-big {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  z-index: 10;
}

/* The canvas asks for 560 px; on a phone that is wider than the screen and a camera
   held close cannot take it in (phone check 2026-11-26). Keep it within the screen. */
.qr-big .qr {
  width: min(70vmin, 560px) !important;
  height: min(70vmin, 560px) !important;
}

.checks {
  list-style: none;
  padding: 0;
  margin: 0;
}

.check-ok {
  color: var(--color-text);
}

.check-bad {
  color: var(--color-error);
  font-weight: 700;
}

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

.summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px var(--space-2);
  margin: 0;
}

.summary dd {
  margin: 0;
}

/* Poster: one A4 sheet, black on white, whatever the screen theme. */
.poster {
  background: #ffffff;
  color: #111111;
  text-align: center;
  padding: 18mm 14mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8mm;
}

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

.poster-site,
.poster-sub {
  font-size: 15pt;
  margin: 0;
}

.poster-qr .qr {
  width: 110mm !important;
  height: 110mm !important;
}

.poster-langs {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13pt;
  line-height: 1.6;
}

@page {
  size: A4;
  margin: 0;
}

@media print {
  .step {
    border: 0;
    padding: 0;
  }

  .no-print,
  .admin-bar {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  .app {
    max-width: none;
    padding: 0;
  }

  /* The page has no margin for the poster; the printed roster brings its own. */
  .roster {
    padding: 15mm;
    color: #000000;
  }

  .poster {
    height: 297mm;
    box-sizing: border-box;
    break-inside: avoid;
  }
}

/* Signed pass: big text for the guard or manager (docs/기획.md 3-4). */
.pass-big {
  font-size: calc(var(--font-size-title) * 1.4);
  font-weight: 700;
  margin: 0;
}

/* Check-in list (docs/기획.md 3-2). */
.scan-video {
  width: 100%;
  max-height: 50vh;
  background: #000000;
  border-radius: var(--radius);
  margin-top: var(--space-1);
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-small);
}

.roster-table th,
.roster-table td {
  border-bottom: 1px solid var(--color-line);
  padding: var(--space-1) 4px;
  text-align: left;
}

.mono {
  font-family: ui-monospace, monospace;
}

/* Document camera (user decision 2026-11-26): the window has the document's shape, the
   white frame sits inside it, and the buttons follow right below. The whole group is
   centred on a full black screen so nothing is pushed out of sight (phone check). */
.doc-camera {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: #000000;
  color: #ffffff;
}

.doc-camera .hint {
  color: #ffffff;
  margin: 0;
}

/* Room left for the hint and two rows of buttons. */
.doc-camera-view {
  --controls: 200px;
  position: relative;
  overflow: hidden;
  align-self: center;
  width: min(100%, calc((100dvh - var(--controls)) * var(--ratio)));
  aspect-ratio: var(--ratio);
  border-radius: var(--radius);
  background: #111111;
}

.doc-camera-view video,
.doc-camera-view canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: none;
  height: auto;
}

.doc-frame {
  position: absolute;
  inset: 5%;
  border: 3px solid #ffffff;
  border-radius: 6px;
  box-shadow: 0 0 0 9999px rgb(0 0 0 / 55%);
  pointer-events: none;
}

/* Album photo: the whole picture fits the window; the frame moves on it. */
.photo-view {
  touch-action: none;
}

.photo-view canvas {
  width: 100%;
}

.photo-frame {
  inset: auto;
}

.frame-size {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: #ffffff;
}

.frame-size input {
  flex: 1;
}

/* Design v2 C pieces of the sign app (user decision 2026-11-26). */
.local-only {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
}

.local-only::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-ok);
  flex: none;
}

.seal-box {
  border: 1px solid var(--color-line-soft);
  border-radius: 12px;
  background: var(--color-surface);
  padding: var(--space-2);
}

.seal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--color-ok);
  font-weight: var(--weight-strong);
  font-size: 18px;
}

.seal-head svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.seal-log {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 14px;
}

.seal-log .mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.seal-log dt {
  color: var(--color-muted);
}

.seal-log dd {
  margin: 0;
  word-break: break-all;
}

.show-manager {
  text-align: center;
  font-weight: var(--weight-strong);
  font-size: 18px;
  margin: 0;
}

/* Company form template box on the builder's first step (features/builder/SheetImport.tsx). */
.sheet-import {
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.sheet-import .notice {
  margin: 4px 0 0;
}

/* Static pages. Colors, sizes and spacing come from src/app/theme.css (prepended at build). */
.site-bar,
.site,
.site-footer {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2);
}

.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-line);
}

.site-bar a,
.site a,
.site-footer a {
  color: var(--color-accent);
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

.site h1 {
  font-size: var(--font-size-title);
}

.site .lead {
  font-size: var(--font-size-body);
}

a.button {
  text-decoration: none;
}

a.button.secondary {
  background: transparent;
  color: var(--color-accent);
}

.site-footer {
  border-top: 1px solid var(--color-line);
  color: var(--color-muted);
  font-size: var(--font-size-small);
}

.rules {
  padding-left: var(--space-3);
}

.rule h3 {
  margin-bottom: 0;
}

#today .rule {
  list-style: none;
  border: 2px solid var(--color-accent);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: inherit;
}

/* Home: the dark band (design v2 C, user decision 2026-11-26). */
.night {
  background: var(--color-night);
  color: var(--color-night-text);
}

.night .site-bar {
  max-width: 1120px;
  border-bottom-color: var(--color-night-line);
}

.night .site-bar a {
  color: var(--color-night-text);
}

.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-2) 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
  color: #ffffff;
}

.hero .lead {
  color: var(--color-night-muted);
  font-size: 17px;
  line-height: 1.65;
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--color-night-accent);
  font-size: 14px;
  margin: 0 0 12px;
}

.night a.button.secondary {
  background: transparent;
  color: var(--color-night-text);
  border-color: var(--color-night-line);
}

.flow {
  background: var(--color-night-2);
  border: 1px solid var(--color-night-line);
  border-radius: 14px;
  padding: var(--space-2);
}

.flow ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.flow li,
.cells li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--color-night-muted);
}

.flow li {
  border: 1px solid var(--color-night-line);
  border-radius: 10px;
  padding: 14px;
}

.flow b,
.cells b {
  color: #ffffff;
  font-size: 16px;
}

.flow p {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px dashed var(--color-night-line);
  border-radius: 10px;
  color: var(--color-night-muted);
  font-size: 14px;
}

.cells {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 1120px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border-top: 1px solid var(--color-night-line);
}

.cells li {
  padding: 22px var(--space-2);
  border-right: 1px solid var(--color-night-line);
}

.cells .tag {
  font-family: var(--font-mono);
  color: var(--color-night-accent);
  font-size: 13px;
}

.site-bar nav a {
  text-decoration: none;
  font-size: 15px;
}

.night .site-bar nav a {
  color: var(--color-night-muted);
}

@media (max-width: 600px) {
  .flow ol {
    grid-template-columns: 1fr;
  }
}

/* Home, below the dark band (layout request 2026-11-26). */
.home-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px var(--space-2) 24px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.home-main h2 {
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
}

.step-cards,
.guide-cards,
.lang-chips,
.promise-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-2);
}

.step-cards li,
.guide-cards a,
.promise-list {
  background: var(--color-surface);
  border: 1px solid var(--color-line-soft);
  border-radius: 14px;
}

.step-cards li {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-cards .num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-text);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.step-cards p {
  margin: 0;
  line-height: 1.6;
}

.promise-list {
  padding: 8px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  column-gap: 40px;
}

.promise-list li {
  position: relative;
  padding: 14px 0 14px 32px;
  border-bottom: 1px solid var(--color-line-soft);
  line-height: 1.6;
}

.promise-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 19px;
  width: 14px;
  height: 8px;
  border-left: 3px solid var(--color-ok);
  border-bottom: 3px solid var(--color-ok);
  transform: rotate(-45deg);
}

.lang-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.lang-chips li {
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
}

.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-2);
}

.guide-cards a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  height: 100%;
  box-sizing: border-box;
  text-decoration: none;
  color: var(--color-text);
}

.guide-cards a:hover {
  border-color: var(--color-accent);
}

.guide-cards b {
  color: var(--color-accent);
  font-size: 17px;
}

.guide-cards span {
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.55;
}

.home .site-footer {
  max-width: 1120px;
}
