/* ==========================================================================
   UP TO YOU · ATOMETAL — 전자시공보증서 플랫폼 UI
   다크/메탈릭 · 자동차 스트릿컬처 톤 · 모바일 우선
   ========================================================================== */
:root {
  --bg: #08090b;
  --bg-2: #0d0f13;
  --panel: #12151a;
  --panel-2: #171b22;
  --line: #242a33;
  --line-soft: #1b2027;
  --ink: #eef1f4;
  --ink-2: #b9c0c8;
  --muted: #7d8792;
  --silver-1: #f2f5f8;
  --silver-2: #c3ccd6;
  --silver-3: #8d97a2;
  --accent: #ff3d2e;
  --accent-dim: #b62a1f;
  --lime: #c8ff3d;
  --ok: #2fbf71;
  --warn: #f0b429;
  --info: #6f9cf5;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", "D2Coding", Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(140, 160, 190, .10), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(255, 61, 46, .07), transparent 55%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 70%);
  z-index: 0;
}

a { color: var(--silver-1); text-decoration: none; }
a:hover { color: #fff; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -0.025em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.16rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
small, .small { font-size: .8rem; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.stack > * + * { margin-top: 14px; }

.wrap { width: min(1120px, 100% - 32px); margin: 0 auto; position: relative; z-index: 1; }
.wrap-narrow { width: min(560px, 100% - 32px); margin: 0 auto; position: relative; z-index: 1; }
.page { padding: 26px 0 72px; }

/* ---------------- 상단 바 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px) saturate(140%);
  background: rgba(8, 9, 11, .82);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  width: min(1120px, 100% - 32px); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  min-height: 62px; padding: 8px 0;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(150deg, #eef2f6 0%, #9aa5b1 42%, #495260 100%);
  display: grid; place-items: center;
  color: #0b0d10; font-weight: 900; font-size: 13px; letter-spacing: -0.06em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 4px 12px rgba(0,0,0,.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b {
  font-size: .82rem; letter-spacing: .18em; font-weight: 800;
  background: linear-gradient(180deg, #fff, #aab4c0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-text span { font-size: .62rem; letter-spacing: .32em; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 12px; border-radius: 8px; white-space: nowrap;
  color: var(--ink-2); font-size: .86rem; font-weight: 600;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(255,255,255,.09); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding-left: 14px; margin-left: 6px;
  border-left: 1px solid var(--line); flex-shrink: 0;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, #2b323c, #171b21); border: 1px solid var(--line);
  font-size: .78rem; font-weight: 700; color: var(--silver-1);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta b { font-size: .8rem; }
.user-meta span { font-size: .68rem; color: var(--muted); }
.icon-btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  border-radius: 8px; padding: 7px 10px; font-size: .76rem; cursor: pointer; font-family: inherit;
}
.icon-btn:hover { color: #fff; border-color: #38404b; }

/* ---------------- 카드/패널 ---------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012)), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card.tight { padding: 16px; }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-head .spacer { flex: 1; }
.panel { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 14px; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; border: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------------- 히어로 ---------------- */
.hero { padding: 46px 0 30px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--silver-3); margin-bottom: 16px;
}
.hero .eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--silver-3); }
.hero h1 {
  font-size: clamp(2rem, 5.4vw, 3.35rem); line-height: 1.08; letter-spacing: -0.045em;
  font-weight: 900; margin-bottom: 14px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #fff 10%, #b7c1cc 45%, #6f7a86 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { color: var(--ink-2); max-width: 46ch; font-size: 1.02rem; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* ---------------- 버튼 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
  transition: transform .06s ease, filter .15s ease, background .15s ease;
  text-align: center; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #f7f9fb 0%, #cdd5de 55%, #a9b3bf 100%);
  color: #0a0c0f; box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 6px 18px rgba(0,0,0,.4);
}
.btn-primary:hover { filter: brightness(1.06); color: #000; }
.btn-accent { background: linear-gradient(180deg, #ff5a4a, #d52d20); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #3a434f; background: rgba(255,255,255,.04); color: #fff; }
.btn-danger { background: transparent; border-color: rgba(255,61,46,.4); color: #ff7a6e; }
.btn-danger:hover { background: rgba(255,61,46,.1); color: #ff9b91; }
.btn-sm { padding: 8px 12px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- 폼 ---------------- */
label.field { display: block; }
.field-label { display: block; font-size: .78rem; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .01em; }
.field-hint { font-size: .72rem; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=password], input[type=tel], input[type=date],
input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; background: #0b0e12; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 12px; font-family: inherit; font-size: .92rem;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #4a5563; box-shadow: 0 0 0 3px rgba(140, 160, 190, .14);
}
input::placeholder, textarea::placeholder { color: #545e69; }
select {
  background-image: linear-gradient(45deg, transparent 50%, #7d8792 50%),
                    linear-gradient(135deg, #7d8792 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}
.field-error { color: #ff8a80; font-size: .76rem; margin-top: 5px; }
.is-invalid { border-color: rgba(255,61,46,.6) !important; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-section { margin-top: 26px; }
.form-section > h3 {
  display: flex; align-items: center; gap: 10px; font-size: .82rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--silver-3); margin: 0 0 14px;
}
.form-section > h3::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.checkline { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--ink-2); }
.checkline input { margin-top: 4px; }

/* ---------------- 배지 / 상태 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { color: #63e0a0; background: rgba(47,191,113,.12); border-color: rgba(47,191,113,.28); }
.badge-expired { color: #c3ccd6; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
.badge-cancelled { color: #ff8a80; background: rgba(255,61,46,.12); border-color: rgba(255,61,46,.3); }
.badge-superseded { color: #9db8ff; background: rgba(111,156,245,.12); border-color: rgba(111,156,245,.3); }
.badge-neutral { color: var(--ink-2); background: rgba(255,255,255,.05); border-color: var(--line); }
.badge-warn { color: #ffd166; background: rgba(240,180,41,.12); border-color: rgba(240,180,41,.3); }
.badge-test { color: #c8ff3d; background: rgba(200,255,61,.1); border-color: rgba(200,255,61,.28); }
.badge-test::before { background: #c8ff3d; }

/* ---------------- 통계 ---------------- */
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.stat .k { font-size: .74rem; color: var(--muted); letter-spacing: .05em; }
.stat .v { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.04em; margin-top: 4px; line-height: 1; }
.stat .d { font-size: .72rem; color: var(--muted); margin-top: 6px; }
.stat::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
}
.stat.accent .v { color: var(--lime); }
.stat.warn .v { color: var(--warn); }

/* ---------------- 테이블 ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: rgba(255,255,255,.02); font-weight: 700; white-space: nowrap;
}
tbody tr:hover { background: rgba(255,255,255,.022); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 700; color: var(--ink); }
.cell-sub { font-size: .76rem; color: var(--muted); }

/* ---------------- 보증서 상세 ---------------- */
.doc {
  background: linear-gradient(180deg, #fdfdfe, #f4f6f8);
  color: #14171c; border-radius: 12px; padding: 26px; border: 1px solid #e3e7ec;
}
.doc .doc-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.doc .doc-brand b { font-size: 1.35rem; letter-spacing: -0.03em; }
.doc .doc-brand span { display: block; font-size: .66rem; letter-spacing: .3em; color: #6b747e; }
.doc .doc-number { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; letter-spacing: .02em; }
.doc table { font-size: .84rem; }
.doc th { background: #eef1f4; color: #4b545e; border-color: #dde2e7; }
.doc td { border-color: #e6eaee; }
.doc .doc-label { color: #6b747e; font-size: .74rem; }
.doc hr { border: 0; border-top: 1px solid #e3e7ec; margin: 18px 0; }
.doc .doc-foot { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-top: 18px; font-size: .76rem; color: #6b747e; }
.doc .qr-holder { text-align: center; }
.doc .qr-holder img { width: 104px; height: 104px; border-radius: 6px; border: 1px solid #e3e7ec; }
.doc .stamp {
  display: inline-block; border: 3px solid rgba(255,61,46,.5); color: rgba(213,45,32,.85);
  padding: 6px 14px; border-radius: 6px; font-weight: 900; letter-spacing: .12em;
  transform: rotate(-6deg); font-size: .9rem;
}

.kv { display: grid; grid-template-columns: 116px 1fr; gap: 8px 14px; font-size: .88rem; }
.kv dt { color: var(--muted); font-size: .78rem; }
.kv dd { margin: 0; color: var(--ink); }

.meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .78rem; color: var(--muted); }

/* ---------------- 타임라인 ---------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 1px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -4.5px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--silver-3); box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}
.timeline .t-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.timeline .t-head b { font-size: .86rem; }
.timeline .t-time { font-size: .72rem; color: var(--muted); }
.timeline .t-note { font-size: .8rem; color: var(--ink-2); margin-top: 3px; }

/* ---------------- 알림/배너 ---------------- */
.flash {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: 10px; padding: 13px 16px; font-size: .87rem;
  border: 1px solid var(--line); background: var(--panel-2); margin-bottom: 18px;
}
.flash strong { display: block; font-size: .8rem; letter-spacing: .04em; margin-bottom: 2px; }
.flash-ok { border-color: rgba(47,191,113,.35); background: rgba(47,191,113,.08); }
.flash-ok strong { color: #7be8ab; }
.flash-err { border-color: rgba(255,61,46,.35); background: rgba(255,61,46,.08); }
.flash-err strong { color: #ff8a80; }
.flash-warn { border-color: rgba(240,180,41,.35); background: rgba(240,180,41,.08); }
.flash-warn strong { color: #ffd166; }
.flash-info { border-color: rgba(111,156,245,.3); background: rgba(111,156,245,.07); }
.flash-info strong { color: #9db8ff; }

.notice-strip {
  display: flex; align-items: center; gap: 10px; font-size: .78rem;
  border: 1px dashed rgba(200,255,61,.3); color: #d7f08a; background: rgba(200,255,61,.05);
  padding: 10px 14px; border-radius: 9px; margin-bottom: 18px;
}

/* ---------------- 인증(verify) ---------------- */
.verify-hero { text-align: center; padding: 34px 0 10px; }
.verify-hero .num { font-family: var(--mono); font-size: clamp(1.1rem, 3.4vw, 1.5rem); letter-spacing: .04em; }
.status-orb {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 16px;
  display: grid; place-items: center; font-size: 1.9rem; font-weight: 900;
  border: 1px solid var(--line);
}
.status-orb.ok { color: #63e0a0; background: radial-gradient(circle at 50% 40%, rgba(47,191,113,.28), transparent 70%); border-color: rgba(47,191,113,.4); }
.status-orb.bad { color: #ff8a80; background: radial-gradient(circle at 50% 40%, rgba(255,61,46,.26), transparent 70%); border-color: rgba(255,61,46,.4); }
.status-orb.gray { color: #c3ccd6; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.12), transparent 70%); }

.mask-note {
  font-size: .74rem; color: var(--muted); border-top: 1px dashed var(--line);
  padding-top: 12px; margin-top: 16px;
}

/* ---------------- 푸터 ---------------- */
.footer {
  border-top: 1px solid var(--line-soft); margin-top: 40px; padding: 26px 0 40px;
  color: var(--muted); font-size: .76rem;
}
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------------- 유틸 ---------------- */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--silver-3); margin: 0 0 10px; }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); font-size: .88rem; }
.empty b { display: block; color: var(--ink-2); margin-bottom: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: .8rem; color: var(--ink-2);
}
.pagination .current { background: rgba(255,255,255,.08); color: #fff; }
.section-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.section-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg-2); }
.section-card .s-name { font-size: .74rem; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.section-card .s-status { font-size: .88rem; font-weight: 700; margin-top: 4px; }
.section-card .s-product { font-size: .76rem; color: var(--ink-2); margin-top: 2px; }
.section-card.installed { border-color: rgba(255,255,255,.16); }
.section-card.not_installed { opacity: .62; }

/* ---------------- 반응형 ---------------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .page { padding: 18px 0 64px; }
  .card { padding: 16px; border-radius: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; flex-wrap: wrap; padding-bottom: 10px; }
  .nav { order: 3; width: 100%; margin-left: 0; padding-bottom: 2px; }
  .user-meta { display: none; }
  .user-chip { border-left: 0; padding-left: 0; margin-left: auto; }
  .kv { grid-template-columns: 96px 1fr; }
  th, td { padding: 10px 10px; }
  .doc { padding: 18px; }
  .stat .v { font-size: 1.5rem; }
  .hero { padding: 26px 0 18px; }
  .hero-actions .btn { flex: 1 1 auto; }
}
@media print {
  .topbar, .footer, .no-print, .hero-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .doc { border: 0; box-shadow: none; }
}
