/* ════════════════════════════════════════════════════════════
   DESIGN TOKENS — 2026
   4개 사이트 공통 (SBU 메인/어드민 · ESDS · SDMS)
   • Primary 네이비 #1e2761
   • Accent 머스타드 #d4a72c
   • Pretendard · 가독성 우선 · 차분한 미니멀
   ════════════════════════════════════════════════════════════ */

/* ── Pretendard 폰트 ── */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

:root {
  /* ─ Brand ─ */
  --primary:        #1e2761;
  --primary-hover:  #161d4a;
  --primary-soft:   #eef0f8;
  --primary-text:   #1e2761;
  --primary-border: #d4d8eb;

  /* ─ Accent (warm mustard) ─ */
  --accent:         #d4a72c;
  --accent-hover:   #b9901e;
  --accent-soft:    #fbf3dc;
  --accent-text:    #8a6c11;

  /* ─ Surface ─ */
  --bg-app:         #fafaf6;   /* 어드민 본문 배경 (페일 크림) */
  --bg-page:        #f7f6f1;   /* 일반 페이지 배경 */
  --surface:        #ffffff;
  --surface-hover:  #fafaf6;
  --surface-elev:   #ffffff;

  /* ─ Text ─ */
  --ink:            #1a1a1a;   /* 본문 */
  --ink-soft:       #2e2e2e;
  --gray-1:         #666666;   /* 강조 보조 */
  --gray-2:         #888888;   /* 일반 보조 */
  --gray-3:         #aaaaaa;   /* 흐린 보조 */
  --gray-4:         #c8c4ba;   /* 비활성 */

  /* ─ Borders ─ */
  --border:         #e5e1d8;
  --border-soft:    #ecebe5;
  --border-strong:  #d2cdc0;

  /* ─ Status ─ */
  --success:        #10b981;
  --success-soft:   #e7f7f1;
  --warning:        #f59e0b;
  --warning-soft:   #fdf3e0;
  --danger:         #e05050;
  --danger-soft:    #fde8e8;
  --info:           #3b82f6;
  --info-soft:      #e8f0fe;

  /* ─ Radius ─ */
  --r-xs:           4px;
  --r-sm:           6px;
  --r-md:           8px;     /* 버튼/입력 */
  --r-lg:           12px;    /* 카드 */
  --r-xl:           16px;
  --r-full:         99px;    /* 배지 */

  /* ─ Shadows (subtle) ─ */
  --shadow-xs:      0 1px 1px rgba(17,24,39,.03);
  --shadow-sm:      0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 12px 32px -8px rgba(17,24,39,.12), 0 4px 12px rgba(17,24,39,.06);

  /* ─ Motion ─ */
  --ease:           cubic-bezier(.22,.61,.36,1);

  /* ─ Font ─ */
  --font-sans:      'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', sans-serif;
}

/* ════════════════════════════════════════════════════════════
   GLOBAL RESET + TYPOGRAPHY
   ════════════════════════════════════════════════════════════ */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body, .dt-scope {
  font-family: var(--font-sans);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "tnum";
}

/* 한국어 가독성: 헤딩 */
h1, .h1, h2, .h2, h3, .h3, h4, .h4 {
  word-break: keep-all;
  overflow-wrap: break-word;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
}

/* 다크 hero 배경 위의 헤딩은 부모 색(흰색) 유지 — 글로벌 ink 규칙 예외 */
.hero-card h1, .hero-card h2, .hero-card h3,
.page-hero h1, .page-hero h2, .page-hero h3,
.sell-hero h1, .sell-hero h2, .sell-hero h3,
.dash-hero h1, .dash-hero h2, .dash-hero h3 {
  color: inherit;
}

/* ════════════════════════════════════════════════════════════
   LUCIDE ICON BASELINE
   ════════════════════════════════════════════════════════════ */
.ico, i[data-lucide], svg.lucide {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  stroke-width: 2;
  color: currentColor;
  flex-shrink: 0;
}
/* 아이콘 크기 변형 */
.ico-sm { width: .9em; height: .9em; }
.ico-lg { width: 1.2em; height: 1.2em; }

/* 상태 점 (status dot — circle 대용) */
.dt-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray-3);
  vertical-align: middle;
}
.dt-dot.success { background: var(--success); }
.dt-dot.warning { background: var(--warning); }
.dt-dot.danger  { background: var(--danger); }
.dt-dot.info    { background: var(--info); }
.dt-dot.muted   { background: var(--gray-3); }

/* ════════════════════════════════════════════════════════════
   UTILITY: BUTTONS (.dt-btn)
   기존 .btn 과 충돌 회피 위해 dt- 프리픽스 + body-level 보강
   ════════════════════════════════════════════════════════════ */
.dt-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 40px; padding: 0 18px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.dt-btn:hover { background: var(--primary-hover); box-shadow: var(--shadow-sm); }
.dt-btn:active { transform: translateY(1px); }
.dt-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

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

.dt-btn-ghost {
  background: transparent;
  color: var(--gray-1);
  border-color: transparent;
}
.dt-btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }

.dt-btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-soft);
}
.dt-btn-danger:hover { background: #fef2f2; border-color: var(--danger); }

.dt-btn-accent {
  background: var(--accent);
  color: #fff;
}
.dt-btn-accent:hover { background: var(--accent-hover); }

.dt-btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.dt-btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.dt-btn-block { width: 100%; }

/* ════════════════════════════════════════════════════════════
   UTILITY: CARD (.dt-card)
   ════════════════════════════════════════════════════════════ */
.dt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.dt-card-hoverable:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.dt-card-flush { padding: 0; overflow: hidden; }
.dt-card-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dt-card-title {
  font-size: 15px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.01em;
}
.dt-card-body { padding: 18px 22px; }

/* ════════════════════════════════════════════════════════════
   UTILITY: INPUT (.dt-input)
   ════════════════════════════════════════════════════════════ */
.dt-input,
.dt-textarea,
.dt-select {
  display: block;
  width: 100%;
  height: 42px;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.dt-textarea { height: auto; min-height: 88px; resize: vertical; line-height: 1.55; }
.dt-input::placeholder, .dt-textarea::placeholder { color: var(--gray-3); }
.dt-input:hover, .dt-textarea:hover, .dt-select:hover { border-color: var(--border-strong); }
.dt-input:focus, .dt-textarea:focus, .dt-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,39,97,.12);
}
.dt-input.error, .dt-textarea.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(224,80,80,.15); }
.dt-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.dt-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.dt-field { margin-bottom: 14px; }
.dt-field-hint { margin-top: 6px; font-size: 12.5px; color: var(--gray-2); }
.dt-field-error { margin-top: 6px; font-size: 12.5px; color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   UTILITY: BADGE (.dt-badge)
   ════════════════════════════════════════════════════════════ */
.dt-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  background: var(--surface-hover);
  color: var(--gray-1);
  letter-spacing: 0;
}
.dt-badge-primary { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-border); }
.dt-badge-accent  { background: var(--accent-soft);  color: var(--accent-text);  border-color: #ecdfb0; }
.dt-badge-success { background: var(--success-soft); color: var(--success);      border-color: #c4eccf; }
.dt-badge-warning { background: var(--warning-soft); color: #b45309;             border-color: #f0d990; }
.dt-badge-danger  { background: var(--danger-soft);  color: var(--danger);       border-color: #f5c8c8; }
.dt-badge-info    { background: var(--info-soft);    color: var(--info);         border-color: #c5d8f7; }
.dt-badge-muted   { background: #f3f3f5;             color: #52525b;             border-color: #e6e6eb; }

/* ════════════════════════════════════════════════════════════
   UTILITY: TABLE STRIPE / WRAP HELPERS
   ════════════════════════════════════════════════════════════ */
.dt-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
  max-width: 100%;
}
/* 모바일 스크롤 힌트 그라데이션 */
@media (max-width: 640px) {
  .dt-table-wrap {
    background:
      linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) left center / 24px 100% no-repeat,
      linear-gradient(to left,  var(--surface) 30%, rgba(255,255,255,0)) right center / 24px 100% no-repeat,
      radial-gradient(ellipse at left,  rgba(0,0,0,.06), transparent 70%) left center / 10px 50% no-repeat,
      radial-gradient(ellipse at right, rgba(0,0,0,.06), transparent 70%) right center / 10px 50% no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
}

/* ════════════════════════════════════════════════════════════
   UTILITY: TEXT HELPERS
   ════════════════════════════════════════════════════════════ */
.dt-muted   { color: var(--gray-2); }
.dt-subtle  { color: var(--gray-3); }
.dt-strong  { font-weight: 700; color: var(--ink); }
.dt-eyebrow { font-size: 11px; font-weight: 700; color: var(--gray-2); letter-spacing: 0.08em; text-transform: uppercase; }

/* ════════════════════════════════════════════════════════════
   FOCUS / A11Y
   ════════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ════════════════════════════════════════════════════════════
   SUBTLE LINK
   ════════════════════════════════════════════════════════════ */
.dt-link {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s var(--ease);
}
.dt-link:hover { border-bottom-color: var(--primary); }

/* ════════════════════════════════════════════════════════════
   MOBILE LEGIBILITY OVERRIDES
   • 너무 작은 폰트는 13.5px 이상으로
   • 한국어 letter-spacing 살짝 좁게
   ════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  body { font-size: 14px; }
}

/* iOS 자동확대 방지 (보조) */
@media (max-width: 768px) {
  .dt-input, .dt-select, .dt-textarea {
    font-size: 16px;
  }
}

/* ════════════════════════════════════════════════════════════
   GLOBAL POLISH — apply to all .dt- scoped components
   기존 .btn / .a-btn 등은 영향 없음 (변수만 매핑)
   ════════════════════════════════════════════════════════════ */
/* 너무 작은 폰트 시각 보호 (12px 이하) — 보조 텍스트는 13px 이상으로 */
.help, .hint, .note, small.muted { font-size: 12.5px; }

/* 한국어 본문 가독 보조 — 너비가 너무 좁아지지 않도록 */
@media (min-width: 768px) {
  p, .p, .desc { max-width: 70ch; }
}
