:root {
  /* Brand — measured from logo JPG: steel navy #28547b, orange #ea8844 */
  --color-primary: #1b4a78;
  --color-primary-dark: #123556;
  --color-accent: #e8823a;
  --color-accent-dark: #ad591c; /* AA 4.5:1 on white(4.97)/surface — text-only token */

  --color-text: #16283a;
  --color-muted: #5a6b7d;
  --color-bg: #f5f5f2;
  --color-surface: #ffffff;
  --color-border: #d5dee8;

  /* Hairline rule + soft panel — the public pages sit on white and separate
     blocks with rules instead of stacking bordered boxes. */
  --color-rule: #e4e9ee;
  --color-rule-strong: #c9d4e0;
  --color-soft: #f5f7f9;

  --color-success: #1f7a4c;
  --color-warning: #c47a12;
  --color-danger: #b42318;

  --font-sans: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR",
    "Segoe UI", sans-serif;
  --font-display: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR",
    "Segoe UI", sans-serif;

  /* One scale, used by every screen.
     caption · body · lead · card-title · section-title · page-title · hero */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.3125rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: clamp(1.75rem, 1.35rem + 1.4vw, 2.25rem);
  --fs-4xl: clamp(2.25rem, 1.5rem + 2.8vw, 3.125rem);

  /* Korean body copy needs a taller line than Latin. */
  --lh-body: 1.75;
  --lh-tight: 1.28;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Vertical rhythm — the only section/field gaps public screens may use. */
  --gap-section: 4rem;
  --gap-section-sm: 2.75rem;
  --gap-head: 2rem;
  --gap-field: 1.25rem;
  --gap-label: 0.5rem;

  /* Reading measures. */
  --measure-lead: 34rem;
  --measure-prose: 46rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(18, 53, 86, 0.06);
  --shadow-md: 0 8px 24px rgba(18, 53, 86, 0.08);

  --container: 1080px;
  --container-wide: 1200px;
  --bp-md: 768px;
  --bp-lg: 1024px;

  --header-h: 4rem;
  --focus-ring: 0 0 0 3px rgba(232, 130, 58, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* Public storefront + service screens sit on white; admin/board screens keep
   the tinted canvas their bordered lists were designed against.
   Qualified with `body` so it outranks `.site-body` in layout.css. */
body.page-home,
body.page-shop,
body.page-shop-order,
body.page-pay,
body.page-orders {
  background: var(--color-surface);
}

/* Money and counts must not jitter as digits change. */
.num,
.shop-card-price,
.shop-detail-price,
.shop-co-product-price,
.shop-co-price-row > span:last-child,
.shop-co-price-total strong,
.shop-pay-amount {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons — three ranks only: primary (solid navy), secondary (navy outline),
   ghost (quiet rule). Never two solid buttons competing in one group. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.875rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-rule-strong);
}

.btn-ghost:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Page-level commitments: hero CTAs, 바로구매, 주문하고 결제하기. */
.btn-lg {
  min-height: 3.25rem;
  padding: 0.85rem 2rem;
  font-size: var(--fs-lg);
}

.btn-block {
  width: 100%;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--gap-label);
  margin-bottom: var(--gap-field);
}

.field label {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--color-primary-dark);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 2.875rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  line-height: 1.4;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27, 74, 120, 0.14);
}

/* Status / badge — single pill definition shared by user + admin screens */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  background: #e8eef5;
  color: var(--color-primary);
}

.badge-warn {
  background: #fff1df;
  color: var(--color-warning);
}

.badge-danger {
  background: #fde8e6;
  color: var(--color-danger);
}

.badge-ok {
  background: #e5f5ec;
  color: var(--color-success);
}

/* Private-board lock — one muted glyph, sized to the text it sits beside.
   Used on the 대행 신청 lists where every row is author-only. */
.list-lock {
  display: inline-flex;
  align-items: center;
  vertical-align: -0.1em;
  margin-right: 0.35rem;
  color: var(--color-muted);
  flex: 0 0 auto;
}

.list-lock svg {
  width: 0.7em;
  height: 0.82em;
  display: block;
}

/* Notice — base + success/error variants, canonical for all screens */
.notice {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #eef3f8;
  color: var(--color-text);
}

.notice-error {
  background: #fef3f2;
  border-color: #fecdca;
  color: var(--color-danger);
}

.notice-success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #027a48;
}

/* Section */
.section {
  padding: var(--gap-section-sm) 0;
}

.section-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--color-primary-dark);
  letter-spacing: -0.025em;
  word-break: keep-all;
}

.section-lead {
  margin: 0 0 var(--gap-head);
  color: var(--color-muted);
  max-width: var(--measure-lead);
  word-break: keep-all;
}

@media (min-width: 768px) {
  .section {
    padding: var(--gap-section) 0;
  }
}

/* ---- Declaration line ----------------------------------------------------
   The site's one repeated structural device: a tracked label, its value, and a
   hairline. It carries the footer's business registry, the hero's route facts,
   and the order/payment amounts, so those screens read as one document. */
.rail {
  margin: 0;
  border-top: 1px solid var(--color-rule);
}

.rail > div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9.5rem) minmax(0, 1fr);
  gap: 0.15rem var(--space-4);
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--color-rule);
}

.rail dt {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.9;
  color: var(--color-muted);
}

.rail dd {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.65;
  word-break: keep-all;
}

/* Stacked variant for narrow columns — label above value, no column collision. */
.rail-stack > div {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem;
}

.rail-stack dt {
  line-height: 1.5;
}

/* Eyebrow — signature: a short directional orange rule echoing the logo mark */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-accent-dark);
}

.eyebrow::before {
  content: "";
  width: 1.5rem;
  height: 2px;
  background: var(--color-accent);
}

.eyebrow-invert {
  color: #ffd7ad;
}

.eyebrow-invert::before {
  background: var(--color-accent);
}

/* Card — kept for list/admin screens. Flattened: a card should read as a
   container, not as a raised object. */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

.data-table th,
.data-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  font-weight: 700;
  background: #f7fafc;
}

/* Empty / pagination */
.empty-state {
  padding: var(--space-6);
  text-align: center;
  color: var(--color-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ── 제출 전 파일 선택 취소 ────────────────────────────────────────
   고른 파일 이름과 "선택 취소"를 입력란 옆에 붙인다. 스크립트가 없으면
   이 블록 자체가 만들어지지 않으므로 폼 동작에는 영향이 없다. */
.file-clear {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.file-clear.is-visible {
  display: flex;
}

.file-clear-name {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  word-break: break-all;
}

.file-clear-button {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 4px);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.file-clear-button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}
