/* NameCard Design System v1 — service UI only, never the company SVG artwork. */
:root {
  color-scheme: light;
  --nc-primary: #1769aa;
  --nc-primary-hover: #125788;
  --nc-text: #263445;
  --nc-muted: #64748b;
  --nc-border: #d5dee8;
  --nc-bg: #f3f6f9;
  --nc-panel: #fff;
  --nc-radius: 14px;
  --nc-control-radius: 9px;
  --nc-shadow: 0 8px 28px rgba(26,45,65,.07);
  --nc-space-1: 4px;
  --nc-space-2: 8px;
  --nc-space-3: 12px;
  --nc-space-4: 16px;
  --nc-space-5: 24px;
  --nc-space-6: 32px;
  --nc-control-height: 48px;
  --nc-touch-height: 44px;
  --nc-text-sm: 13px;
  --nc-text-body: 16px;
  --nc-text-section: 18px;
  --nc-soft-bg: #edf2f7;
  --nc-soft-text: #52657b;
  --nc-error: #b42318;
}
html { -webkit-text-size-adjust: 100%; }
body.nc-home, body.nc-auth, body.nc-admin, body.nc-public {
  color: var(--nc-text);
  background: var(--nc-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  line-height: 1.5;
}
body.nc-home *, body.nc-auth *, body.nc-admin *, body.nc-public * { box-sizing: border-box; }
body.nc-home button, body.nc-auth button, body.nc-admin button, body.nc-public button {
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-control-radius);
  background: white;
  color: var(--nc-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--nc-space-2);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
body.nc-home button:hover, body.nc-auth button:hover, body.nc-admin button:hover, body.nc-public button:hover {
  border-color: #9aafc3;
  background: #f7fafc;
}
body.nc-home :is(button,input,textarea,select):focus-visible,
body.nc-auth :is(button,input,textarea,select):focus-visible,
body.nc-admin :is(button,input,textarea,select):focus-visible,
body.nc-public :is(button,input,textarea,select):focus-visible {
  outline: 3px solid rgba(23,105,170,.22);
  outline-offset: 2px;
}
body.nc-home input, body.nc-auth input, body.nc-admin .field :is(input,textarea,select) {
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-control-radius);
  background: #fff;
  color: var(--nc-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
}
body.nc-home input::placeholder, body.nc-auth input::placeholder,
body.nc-admin .field :is(input,textarea)::placeholder { color: #879aae; opacity: 1; font-weight: 400; }

/* Landing */
body.nc-home { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
body.nc-home .container {
  width: min(100%, 460px); max-width: 460px; margin: 0;
  padding: clamp(26px, 6vw, 42px); border: 1px solid var(--nc-border);
  border-radius: 20px; box-shadow: var(--nc-shadow); background: var(--nc-panel);
}
.nc-brand { display:flex; align-items:center; gap:10px; color:var(--nc-primary); font-weight:800; font-size:19px; letter-spacing:-.4px; }
.nc-brand-mark { display:grid; place-items:center; width:39px; height:39px; color:#fff; font-size:13px; border-radius:12px; background:var(--nc-primary); }
body.nc-home h1 { text-align:left; font-size:28px; letter-spacing:-.7px; margin:25px 0 5px; line-height:1.2; }
body.nc-home .nc-intro { color:var(--nc-muted); margin:0 0 28px; font-size:14px; }
body.nc-home .nc-input-label { display:block; margin:0 0 8px; font-size:14px; font-weight:700; }
body.nc-home input { min-height:var(--nc-control-height); padding:12px 14px; margin-bottom:18px; }
body.nc-home button { min-height:var(--nc-control-height); margin-bottom:10px; padding:12px; }
body.nc-home button.primary,
body.nc-admin button.primary { background:var(--nc-primary); color:#fff; border-color:var(--nc-primary); }
body.nc-home button.primary:hover, body.nc-admin button.primary:hover { background:var(--nc-primary-hover); border-color:var(--nc-primary-hover); }
body.nc-home button.secondary { color:var(--nc-primary); border-color:#a9c6dd; background:#fff; }

/* Authentication fallback page: style only; authentication logic is untouched. */
body.nc-auth { max-width:480px; margin:40px auto; padding:24px 20px; line-height:1.6; }
body.nc-auth h2 { color:var(--nc-primary); font-size:26px; margin:0 0 8px; }
body.nc-auth p { color:var(--nc-muted); }
body.nc-auth #loginForm { margin:20px 0; }
body.nc-auth input { min-height:48px; padding:12px 14px; }
body.nc-auth button { min-height:46px; padding:10px 14px; }
body.nc-auth #loginForm button { color:#fff; background:var(--nc-primary); border-color:var(--nc-primary); }
body.nc-auth #message { color:var(--nc-text); }

/* Admin: one typographic / form / button system. */
body.nc-admin { font-size:var(--nc-text-body); line-height:1.55; }
body.nc-admin .app { max-width:1480px; padding:24px 20px 70px; }
body.nc-admin h1 { margin:4px 0 5px; font-size:26px; font-weight:750; letter-spacing:-.5px; }
body.nc-admin .sub { font-size:14px; margin:0 0 20px; color:var(--nc-muted); }
body.nc-admin .layout { grid-template-columns:minmax(300px,365px) minmax(0,1fr); gap:20px; align-items:start; }
body.nc-admin .panel, body.nc-admin .preview-box {
  min-width:0; background:var(--nc-panel); border:1px solid var(--nc-border);
  border-radius:var(--nc-radius); padding:var(--nc-space-5); box-shadow:0 2px 14px rgba(24,46,68,.035);
}
body.nc-admin .panel h2, body.nc-admin .preview-box h2 { font-size:var(--nc-text-section); margin:0 0 var(--nc-space-4); letter-spacing:-.2px; }
body.nc-admin .panel h3 { font-size:16px; margin:var(--nc-space-5) 0 var(--nc-space-3); }
body.nc-admin .field { display:block; font-size:14px; font-weight:650; line-height:1.5; margin-bottom:var(--nc-space-4); }
body.nc-admin .field :is(input,textarea,select) {
  width:100%; min-height:var(--nc-control-height); display:block; margin-top:var(--nc-space-2);
  padding:11px 13px; line-height:1.5; font-size:16px;
}
body.nc-admin .field textarea { min-height:72px; resize:vertical; }
body.nc-admin .muted { color:var(--nc-muted); font-size:var(--nc-text-sm); line-height:1.6; }
body.nc-admin .separator { border-top-color:#e7ecf2; margin:24px 0; }
body.nc-admin details > summary { border-radius:7px; padding:9px 0; font-size:14px; }
body.nc-admin .group-row { align-items:flex-start; gap:8px; }
body.nc-admin button { padding:11px 15px; font-size:15px; min-height:42px; }
body.nc-admin .small-button { font-size:14px; padding:8px 11px; min-height:38px; }
body.nc-admin .tabs { gap:8px; margin:0 0 16px; }
body.nc-admin .tabs button[aria-pressed="true"], body.nc-public .public-tabs button[aria-pressed="true"] {
  background:var(--nc-primary); border-color:var(--nc-primary); color:white;
}
body.nc-admin .preview-box { position:sticky; top:16px; }
body.nc-admin .face { max-width:900px; overflow:hidden; box-shadow:0 4px 18px rgba(0,0,0,.10); }
body.nc-admin .face svg { width:100%; max-width:100%; height:auto; }
body.nc-admin #cardSaveButton { min-height:46px; padding:12px 22px; }
body.nc-admin .check { margin:var(--nc-space-3) 0; font-size:14px; align-items:flex-start; }
body.nc-admin .check input { accent-color:var(--nc-primary); width:18px; height:18px; margin-top:2px; }
body.nc-admin #cardSaveStatus { font-size:var(--nc-text-sm); }
/* Consistent form rhythm: an action button followed by a new field starts a new row. */
body.nc-admin .panel > button + .field { margin-top:var(--nc-space-5); }
body.nc-admin .panel > :is(.muted,.check) { line-height:1.6; }
/* The editor tools and preview share a single width, independent of screen size. */
body.nc-admin .preview-box > :is(h2,.tabs,.faces,.buttons,.muted) {
  width:min(100%,900px); margin-left:auto; margin-right:auto;
}
/* Consistent service icons; always paired with visible text. */
.nc-icon { width:18px; height:18px; flex:0 0 18px; display:inline-block; fill:none;
  stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round;
  vertical-align:-.15em; pointer-events:none; }
.nc-icon--small { width:16px; height:16px; flex-basis:16px; }
body.nc-home #emailAuthButton:disabled { opacity:1; background:var(--nc-soft-bg);
  border-color:var(--nc-border); color:var(--nc-soft-text); cursor:default; }
body.nc-home #emailAuthStatus { margin:2px 0 0; font-size:var(--nc-text-sm); color:var(--nc-muted); line-height:1.55; }
body.nc-home #emailAuthStatus:empty { display:none; }
body.nc-home #emailAuthStatus[data-state="error"] { color:var(--nc-error); }
body.nc-admin #logoutButton { background:var(--nc-soft-bg); color:var(--nc-soft-text); border-color:var(--nc-border); }
body.nc-admin #authGate { background:white; border:1px solid var(--nc-border); box-shadow:var(--nc-shadow); }
body.nc-admin #authGate a { color:var(--nc-primary); }
.nc-mobile-switch { display:none; }

/* Public business cards retain exact SVG contents / proportions. */
body.nc-public { padding:clamp(24px,5vw,48px) 16px; min-height:100vh; }
body.nc-public .card { border:1px solid var(--nc-border); border-radius:var(--nc-radius); box-shadow:var(--nc-shadow); }
body.nc-public h1 { color:var(--nc-text); font-size:25px; margin:3px 0 22px; }
body.nc-public .message { color:var(--nc-muted); font-size:14px; line-height:1.6; }
body.nc-public .card.svg-mode {
  max-width:980px; padding:0 0 16px; border:0; border-radius:0;
  box-shadow:none; background:transparent;
}
body.nc-public .public-tabs { gap:8px; margin:0 0 19px; }
body.nc-public .public-tabs button { padding:10px 22px; border-radius:var(--nc-control-radius); min-height:42px; }
body.nc-public .public-face { max-width:900px; overflow:hidden; box-shadow:0 5px 20px rgba(0,0,0,.11); }
body.nc-public .public-face svg { width:100%; max-width:100%; height:auto; }

/* On tablets, avoid the old preview-first ordering that pushes form controls far down. */
@media (max-width:900px) {
  body.nc-admin .layout { grid-template-columns:minmax(0,1fr); }
  body.nc-admin .panel { order:0; }
  body.nc-admin .preview-box { order:1; position:static; }
}
/* On phones only one task at a time; desktop and tablet show both sections. */
@media (max-width:720px) {
  body.nc-admin .app { padding:14px 12px 48px; }
  body.nc-admin h1 { font-size:22px; }
  body.nc-admin .sub { margin-bottom:14px; }
  body.nc-admin .layout { display:block; }
  body.nc-admin .panel, body.nc-admin .preview-box { padding:16px; border-radius:12px; }
  body.nc-admin .nc-mobile-switch {
    display:grid; grid-template-columns:1fr 1fr; gap:5px; margin:0 0 14px;
    padding:5px; border:1px solid var(--nc-border); border-radius:12px; background:#e9eff5;
    position:sticky; top:0; z-index:4;
  }
  body.nc-admin .nc-mobile-switch button {
    border:0; padding:12px 8px; min-height:44px; background:transparent; font-size:14px;
  }
  body.nc-admin .nc-mobile-switch button[aria-pressed="true"] {
    background:#fff; color:var(--nc-primary); box-shadow:0 2px 7px rgba(20,48,72,.09);
  }
  body.nc-admin[data-mobile-view="edit"] #adminPreviewPanel,
  body.nc-admin[data-mobile-view="preview"] #adminFormPanel { display:none; }
  body.nc-admin .preview-box { margin-top:0; }
  body.nc-admin .preview-box .face { box-shadow:0 3px 14px rgba(0,0,0,.09); }
  body.nc-admin #cardSaveButton { width:100%; }
  body.nc-admin button { min-height:var(--nc-touch-height); }
  body.nc-admin .preview-box .buttons:not(.tabs) { display:grid; grid-template-columns:1fr; }
  body.nc-admin .preview-box .buttons:not(.tabs) button { width:100%; }
  body.nc-public { padding:24px 12px; }
  body.nc-public h1 { font-size:22px; }
  body.nc-public .card.svg-mode { padding:0; }
}
@media (prefers-reduced-motion:reduce) {
  body.nc-home button, body.nc-auth button, body.nc-admin button, body.nc-public button { transition:none; }
}

/* NameCard operator disclosure: outside user-supplied SVG and shared PNG. */
body.nc-public .nc-operator-notice {
  max-width:900px;
  margin:18px auto 8px;
  padding:0 8px;
  color:#5b6878;
  font-size:13px;
  line-height:1.65;
  text-align:center;
  overflow-wrap:anywhere;
}

/* One shared navigation pattern for homepage, public cards and account editor. */
.nc-breadcrumbs {
  width:100%; display:flex; align-items:center; flex-wrap:wrap;
  gap:7px; margin:0 0 18px; color:var(--nc-muted);
  font-size:13px; line-height:1.6; overflow-wrap:anywhere;
}
.nc-breadcrumbs a {color:var(--nc-primary); text-decoration:none; border-bottom:1px solid transparent;}
.nc-breadcrumbs a:hover {border-bottom-color:currentColor;}
.nc-breadcrumbs a:focus-visible {outline:3px solid rgba(23,105,170,.25); outline-offset:3px;}
.nc-breadcrumbs [aria-current="page"] {font-weight:750; color:var(--nc-text);}
.nc-breadcrumbs [aria-disabled="true"] {color:#8a9baa; cursor:default; text-decoration:none;}
.nc-breadcrumbs .nc-breadcrumb-divider {color:#9eacba;}
.nc-breadcrumbs small {font-weight:400; font-size:12px; color:var(--nc-muted);}
body.nc-home .nc-breadcrumbs {margin-bottom:12px;}
body.nc-admin .nc-breadcrumbs {margin-bottom:14px;}
body.nc-public .nc-public-breadcrumbs {max-width:900px; margin:0 auto 18px;}
body.nc-admin .nc-template-hint {margin:-4px 0 18px; font-size:13px; color:var(--nc-muted);}
body.nc-home .nc-how-it-works {border-top:1px solid var(--nc-border); margin-top:22px; padding-top:14px;}
body.nc-home .nc-how-it-works h2 {font-size:15px; margin:0 0 12px;}
body.nc-home .nc-how-it-works ol {list-style:none; margin:0; padding:0; display:grid; gap:10px;}
body.nc-home .nc-how-it-works li {display:flex; gap:9px; align-items:flex-start; color:var(--nc-muted); font-size:13px;}
body.nc-home .nc-how-it-works .nc-icon {color:var(--nc-primary); width:16px; height:16px; flex-basis:16px; margin-top:2px;}
body.nc-public .nc-create-own {margin:18px auto 8px; max-width:900px; border:1px solid var(--nc-border);
  border-radius:var(--nc-radius); padding:19px; background:#fff; text-align:center;}
body.nc-public .nc-create-own p {font-size:13px; color:var(--nc-muted); margin:0 0 12px;}
body.nc-public .nc-create-own-link {display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:var(--nc-primary); border-radius:var(--nc-control-radius); color:#fff;
  padding:12px 18px; min-height:44px; font-size:14px; font-weight:700; text-decoration:none;}
body.nc-public .nc-create-own-link:hover {background:var(--nc-primary-hover);}
body.nc-public .nc-create-own-link:focus-visible {outline:3px solid rgba(23,105,170,.3); outline-offset:3px;}
@media(max-width:720px) {
  .nc-breadcrumbs {gap:6px; font-size:12px;}
  .nc-breadcrumbs small {display:block;}
  /* In the public card mobile navigation, show the three links on one line. */
  body.nc-public .nc-public-breadcrumbs {flex-wrap:nowrap;}
  body.nc-public .nc-public-breadcrumbs #ncViewedCardEmail {display:none;}
  body.nc-public .nc-create-own-link {width:100%;}
}

/* First-card assistance; shown only when Firestore confirms no saved card. */
body.nc-admin .nc-first-guide {
  display:flex; flex-wrap:wrap; align-items:center; gap:8px 18px;
  padding:16px 20px; margin:0 0 16px; border:1px solid var(--nc-border);
  border-radius:var(--nc-radius); background:#fff;
}
body.nc-admin .nc-first-guide[hidden], body.nc-admin #ncInputProgress[hidden] { display:none; }
body.nc-admin .nc-first-guide strong { font-size:15px; }
body.nc-admin .nc-first-guide span { font-size:13px; color:var(--nc-primary); font-weight:650; }
body.nc-admin .nc-first-guide p { flex-basis:100%; color:var(--nc-muted); margin:0; font-size:13px; }
body.nc-admin .nc-form-heading { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
body.nc-admin .nc-form-heading h2 { margin-bottom:var(--nc-space-4); }
/* The real company SVG remains unchanged; only on-screen sample values fade. */
body.nc-admin #adminPreviewPanel [data-field].nc-example-only { opacity:.5; }


/* Home: five compact registry-driven statistics. The email form remains primary. */
body.nc-home .nc-template-stats {
  border-top:1px solid var(--nc-border); margin-top:18px; padding-top:14px;
}
body.nc-home .nc-template-stats h2 { font-size:15px; margin:0 0 10px; }
body.nc-home .nc-template-stats-grid {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0;
}
body.nc-home .nc-template-stats-grid > div {
  min-width:0; padding:10px 7px 8px; text-align:center;
  border:1px solid var(--nc-border); border-radius:9px; background:#f7f9fb;
}
body.nc-home .nc-template-stats-grid dt {
  font-size:11px; line-height:1.4; color:var(--nc-muted); word-break:keep-all;
}
body.nc-home .nc-template-stats-grid dd {
  margin:5px 0 0; font-size:21px; line-height:1.2; font-weight:750;
  color:var(--nc-text); font-variant-numeric:tabular-nums;
}
body.nc-home .nc-template-stats-note {font-size:12px; margin:8px 0 0; color:var(--nc-muted);}
body.nc-home .nc-template-stats-note:empty { display:none; }
