/* 시큐리티안 admin 전역 기본 스타일 — 리셋 · Pretendard · 포커스 링 · 스크롤바 · 브라우저 장식 숨김 · 아이콘 마스크 기본 (tokens.css 다음에 붙인다) */

/* ── 1. 글꼴 — Pretendard 자체 호스팅(fonts/README.md) ─────────── */
@font-face { font-family: "Pretendard"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Pretendard-Regular.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Pretendard-Medium.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/Pretendard-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/Pretendard-Bold.woff2") format("woff2"); }

/* ── 2. 리셋 ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, pre, hr { margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
img, video, canvas { display: block; max-width: 100%; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--line); }

/* ── 3. 본문 기본 — 13px · 1.4 ─────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
}
h1 { font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: var(--ls-title); }
h2 { font-size: var(--fs-15); font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
h3 { font-size: var(--fs-13); font-weight: var(--fw-semibold); }
h4, h5, h6 { font-size: var(--fs-12); font-weight: var(--fw-semibold); }
b, strong { font-weight: var(--fw-semibold); }
small { font-size: var(--fs-12); }
a { color: var(--text); text-decoration: none; }
code, kbd, samp, pre { font-family: inherit; font-size: inherit; }  /* 모노스페이스 금지 */
.ds-tnum { font-variant-numeric: tabular-nums; }                     /* 숫자 자리 맞춤 */

/* ── 4. 폼 요소 ───────────────────────────────────────────────────
   리셋은 :where() 로 무게 0 — 컴포넌트 단일 클래스 규칙(.ds-btn--primary 등)이 항상 이긴다(2026-10-18, ds-impl-form 보고).
   공통(모든 폼 요소)은 글꼴 상속만. 기본 모양 제거는 ds- 컴포넌트와 클래스 없는 맨 요소에만 건다.
   ds- 가 아닌 자기 클래스가 붙은 기존 요소(class="chk" · DataGrid 내부 등)는 브라우저 기본 모양 유지 — 화면을 옮기는 동안 깨지지 않게. */
button, input, select, textarea { font: inherit; letter-spacing: inherit; }
:where(button, input, select, textarea):where([class^="ds-"], [class*=" ds-"], :not([class])) {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  color: inherit;
}
button:where([class^="ds-"], [class*=" ds-"], :not([class])) { padding: 0; border: 0; background: transparent; cursor: pointer; }
button:where([class^="ds-"], [class*=" ds-"], :not([class])):disabled { cursor: not-allowed; }
input, textarea { caret-color: var(--accent-text); }
textarea:where([class^="ds-"], [class*=" ds-"], :not([class])) { resize: vertical; }
input[type="number"]:where([class^="ds-"], [class*=" ds-"], :not([class])) { -moz-appearance: textfield; }

/* 클래스 없는 맨 요소만 — 컴포넌트가 붙기 전 기존 화면에서 안 보이게 되는 것을 막는 최소 모양.
   ds- 컴포넌트는 클래스가 있으므로 여기 걸리지 않는다. */
button:not([class]) {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: var(--btn2);
  color: var(--text);
  font-weight: var(--fw-medium);
}
button:not([class]):hover { background: var(--btn2-hover); }
button:not([class]):active { box-shadow: var(--shadow-press); }
button:not([class]):disabled { background: var(--disabled-bg); color: var(--faint); box-shadow: none; }
input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="hidden"], [type="button"], [type="submit"], [type="reset"], [type="color"], [type="image"], [class]),
textarea:not([class]),
select:not([class]) {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
}
textarea:not([class]) { padding: 7px 10px; }
input:not([class]):hover, textarea:not([class]):hover, select:not([class]):hover { border-color: var(--line-hover); }
input:not([class]):disabled, textarea:not([class]):disabled, select:not([class]):disabled { background: var(--disabled-bg); color: var(--faint); cursor: not-allowed; }
input[type="checkbox"]:not([class]), input[type="radio"]:not([class]) {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
input[type="radio"]:not([class]) { border-radius: var(--radius-round); }
input[type="checkbox"]:not([class]):checked { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
input[type="radio"]:not([class]):checked { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 4px var(--surface); }

/* ── 5. 포커스 링 — 키보드일 때만, 기본 파란 링 제거 ─────────── */
:focus-visible { outline: var(--focus-ring-width) solid var(--accent-text); outline-offset: var(--focus-ring-offset); }
:focus:not(:focus-visible) { outline: none; }

/* ── 6. 스크롤바 — Windows 포함 같은 모양(8px · 썸 line-hover · 트랙 line-row) ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--line-row); }
::-webkit-scrollbar-thumb { background: var(--line-hover); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
::-webkit-scrollbar-corner { background: var(--line-row); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--line-hover) var(--line-row); }
}

/* ── 7. 선택색 · placeholder · 자동완성 바탕 ──────────────────── */
::selection { background: var(--sel-bg); color: var(--text); }
::placeholder { color: var(--faint); opacity: 1; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 9999s;
}

/* ── 8. 목록 마커 ──────────────────────────────────────────────── */
:where(ul, ol):where([class^="ds-"], [class*=" ds-"]) { margin: 0; padding: 0; list-style: none; }
ul:not([class]) > li::marker, ol:not([class]) > li::marker { color: var(--muted); }
.ds-list > li { position: relative; padding-left: 14px; }
.ds-list > li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 6px; height: 1px; background: var(--muted); }

/* ── 9. 브라우저 기본 장식 숨김 — 검색 취소 · 비밀번호 눈 · number 스피너 · date 아이콘 ──
   4절과 같은 범위(ds- · 클래스 없는 맨 요소)만. 기존 클래스 요소의 date 피커 등은 그대로 동작한다. */
input[type="search"]:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-search-cancel-button,
input[type="search"]:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-search-decoration,
input[type="search"]:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-search-results-button,
input[type="search"]:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-ms-reveal,
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-ms-clear { display: none; }
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-credentials-auto-fill-button,
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-contacts-auto-fill-button,
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-strong-password-auto-fill-button { visibility: hidden; display: none; pointer-events: none; }
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-inner-spin-button,
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-calendar-picker-indicator { display: none; }
input:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-clear-button { display: none; }
details > summary:is([class^="ds-"], [class*=" ds-"], :not([class])) { list-style: none; }
details > summary:is([class^="ds-"], [class*=" ds-"], :not([class]))::-webkit-details-marker { display: none; }

/* ── 10. 움직임 줄이기 — 시간 토큰을 0 으로. 무한 반복(스피너·스켈레톤)은 컴포넌트가 animation: none ── */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-modal: 0ms;
    --dur-drawer: 0ms;
    --dur-row: 0ms;
    --dur-row-flash: 0ms;
    --dur-tab-spin: 0ms;
    --delay-tooltip: 0ms;
  }
  html { scroll-behavior: auto; }
}

/* ── 11. 화면읽기 전용 · 숨긴 원본 요소 다음 칸에 포커스 링 ─────── */
.ds-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.ds-sr-only:focus-visible + * { outline: var(--focus-ring-width) solid var(--accent-text); outline-offset: var(--focus-ring-offset); }

/* ── 12. 아이콘 마스크 기본 — 모양은 icons.css 의 .ds-i-<이름>, 색은 글자색(currentColor) ── */
.ds-ic {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* 로고 마크 — 색 테마(data-palette)의 --accent 로 칠한다(사용자 2026-11-02 「태마별로 로고 색상도 변경」).
   assets/logo/logo-mask.png = 원본 logo-mark.png 의 알파 지도(위 S = 불투명 1 · 아래 방패 = 0.58) — 한 색으로 칠해도 두 톤이 남는다 */
.ds-logo {
  display: inline-block;
  flex: none;
  width: 24px;
  height: 24px;
  background-color: var(--accent);
  -webkit-mask: url("assets/logo/logo-mask.png") center / contain no-repeat;
  mask: url("assets/logo/logo-mask.png") center / contain no-repeat;
}
:root[data-theme="dark"] .ds-logo { background-color: var(--accent-text); }   /* 다크는 --accent 가 바탕에 묻혀 밝은 주색으로 */
