/* ==========================================================================
   Qditer Tenant Theme CSS  v2
   - Tailwind는 레이아웃/간격/반응형 전용
   - 색상은 전부 CSS 변수 기반 (컴포넌트 내부 하드코딩 금지)
   - v2 변경: elevation 시스템, state-layer 토큰, type scale,
              dark mode 지원, focus-visible 정비
========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
========================================================================== */

:root {
  /* ── Brand ─────────────────────────────────────────────────── */
  --color-primary-rgb: 37 99 235;
  --color-secondary-rgb: 71 85 105;
  --color-accent-rgb: 124 58 237;

  /* ── Surface (base → tinted surface 5단계) ──────────────────── */
  --color-bg-base-rgb:      255 255 255;   /* body 배경            */
  --color-bg-surface-rgb:   248 250 252;   /* 섹션 배경, 입력 배경  */
  --color-bg-surface1-rgb:  241 245 249;   /* 호버 상태 배경       */
  --color-bg-surface2-rgb:  226 232 240;   /* 선택된 배경, 구분선  */
  --color-bg-card-rgb:      255 255 255;   /* 카드 배경            */

  /* ── Text ───────────────────────────────────────────────────── */
  --color-text-main-rgb:   15 23 42;
  --color-text-muted-rgb:  100 116 139;
  --color-text-subtle-rgb: 148 163 184;

  /* ── On-color (색상 배경 위의 텍스트) ──────────────────────── */
  --color-on-primary-rgb:   255 255 255;
  --color-on-secondary-rgb: 255 255 255;
  --color-on-accent-rgb:    255 255 255;
  --color-on-danger-rgb:    255 255 255;

  /* ── Semantic State ─────────────────────────────────────────── */
  --color-success-rgb: 16 185 129;
  --color-warning-rgb: 245 158 11;
  --color-danger-rgb:  239 68 68;
  --color-info-rgb:    6 182 212;

  /* ── Border ─────────────────────────────────────────────────── */
  --color-border-default-rgb: 226 232 240;
  --color-border-muted-rgb:   241 245 249;
  --color-border-strong-rgb:  203 213 225;

  /* ── Effects ─────────────────────────────────────────────────── */
  --color-shadow-rgb:  15 23 42;
  --color-overlay-rgb: 15 23 42;

  /* ── State Layer (Material 3 스타일, primary 기준) ─────────── */
  --state-hover-opacity:    0.08;
  --state-pressed-opacity:  0.12;
  --state-focused-opacity:  0.12;
  --state-dragged-opacity:  0.16;
  --state-disabled-opacity: 0.38;

  /* ── Elevation ───────────────────────────────────────────────── */
  --elevation-0: none;
  --elevation-1: 0 1px 3px rgb(var(--color-shadow-rgb) / 0.04),
                 0 1px 2px rgb(var(--color-shadow-rgb) / 0.06);
  --elevation-2: 0 4px 12px rgb(var(--color-shadow-rgb) / 0.08),
                 0 2px 4px  rgb(var(--color-shadow-rgb) / 0.04);
  --elevation-3: 0 12px 28px rgb(var(--color-shadow-rgb) / 0.12),
                 0 4px  8px  rgb(var(--color-shadow-rgb) / 0.06);
  --elevation-4: 0 24px 56px rgb(var(--color-shadow-rgb) / 0.18),
                 0 8px  16px rgb(var(--color-shadow-rgb) / 0.08);

  /* ── Radius ──────────────────────────────────────────────────── */
  --radius-xs:   0.25rem;
  --radius-sm:   0.375rem;
  --radius-md:   0.625rem;   /* 이전 0.75rem → 살짝 타이트하게 */
  --radius-lg:   0.875rem;
  --radius-xl:   1.25rem;
  --radius-2xl:  1.75rem;
  --radius-full: 9999px;

  /* ── Type Scale ──────────────────────────────────────────────── */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.8125rem;  /* 13px */
  --text-base: 0.875rem;   /* 14px */
  --text-md:   0.9375rem;  /* 15px */
  --text-lg:   1rem;       /* 16px */
  --text-xl:   1.125rem;   /* 18px */
  --text-2xl:  1.25rem;    /* 20px */
  --text-3xl:  1.5rem;     /* 24px */

  /* ── Motion ──────────────────────────────────────────────────── */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-decel:    cubic-bezier(0, 0, 0.2, 1);  /* 새 요소 진입  */
  --ease-accel:    cubic-bezier(0.4, 0, 1, 1);  /* 요소 퇴장     */
  --duration-fast:   120ms;
  --duration-normal: 220ms;
  --duration-slow:   350ms;

  /* ── Legacy aliases (하위 호환) ──────────────────────────────── */
  --shadow-sm: var(--elevation-1);
  --shadow-md: var(--elevation-2);
  --shadow-lg: var(--elevation-3);
  --shadow-xl: var(--elevation-4);
  --transition-smooth: var(--ease-standard);
}


/* ==========================================================================
   2. DARK MODE TOKENS
========================================================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-base-rgb:      10 15 28;
    --color-bg-surface-rgb:   15 23 42;
    --color-bg-surface1-rgb:  22 33 57;
    --color-bg-surface2-rgb:  30 46 76;
    --color-bg-card-rgb:      17 26 46;

    --color-text-main-rgb:   226 232 240;
    --color-text-muted-rgb:  100 116 139;
    --color-text-subtle-rgb: 51 65 85;

    --color-border-default-rgb: 30 41 59;
    --color-border-muted-rgb:   22 33 57;
    --color-border-strong-rgb:  51 65 85;

    --color-shadow-rgb:  0 0 0;

    --elevation-1: 0 1px 3px rgb(var(--color-shadow-rgb) / 0.2),
                   0 1px 2px rgb(var(--color-shadow-rgb) / 0.3);
    --elevation-2: 0 4px 12px rgb(var(--color-shadow-rgb) / 0.35);
    --elevation-3: 0 12px 28px rgb(var(--color-shadow-rgb) / 0.45);
    --elevation-4: 0 24px 56px rgb(var(--color-shadow-rgb) / 0.6);
  }
}

/* 클래스 기반 dark mode (.dark) — Tailwind dark: prefix와 연동 */
.dark {
  --color-bg-base-rgb:      10 15 28;
  --color-bg-surface-rgb:   15 23 42;
  --color-bg-surface1-rgb:  22 33 57;
  --color-bg-surface2-rgb:  30 46 76;
  --color-bg-card-rgb:      17 26 46;

  --color-text-main-rgb:   226 232 240;
  --color-text-muted-rgb:  100 116 139;
  --color-text-subtle-rgb: 51 65 85;

  --color-border-default-rgb: 30 41 59;
  --color-border-muted-rgb:   22 33 57;
  --color-border-strong-rgb:  51 65 85;

  --color-shadow-rgb: 0 0 0;

  --elevation-1: 0 1px 3px rgb(var(--color-shadow-rgb) / 0.2),
                 0 1px 2px rgb(var(--color-shadow-rgb) / 0.3);
  --elevation-2: 0 4px 12px rgb(var(--color-shadow-rgb) / 0.35);
  --elevation-3: 0 12px 28px rgb(var(--color-shadow-rgb) / 0.45);
  --elevation-4: 0 24px 56px rgb(var(--color-shadow-rgb) / 0.6);
}


/* ==========================================================================
   3. BASE
========================================================================== */

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

body {
  background-color: rgb(var(--color-bg-base-rgb));
  color: rgb(var(--color-text-main-rgb));
  font-size: var(--text-base);
  line-height: 1.6;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* focus-visible: 글로벌 + 컴포넌트 override 구조 */
:focus-visible {
  outline: 2px solid rgb(var(--color-primary-rgb));
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* 마우스 클릭 시 outline 제거 (포커스링은 키보드만) */
:focus:not(:focus-visible) {
  outline: none;
}

a {
  color: rgb(var(--color-primary-rgb));
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: rgb(var(--color-primary-rgb) / 0.8);
}


/* ==========================================================================
   4. TEXT UTILITIES
========================================================================== */

.c-main     { color: rgb(var(--color-text-main-rgb)); }
.c-muted    { color: rgb(var(--color-text-muted-rgb)); }
.c-subtle   { color: rgb(var(--color-text-subtle-rgb)); }
.c-primary  { color: rgb(var(--color-primary-rgb)); }
.c-secondary{ color: rgb(var(--color-secondary-rgb)); }
.c-accent   { color: rgb(var(--color-accent-rgb)); }
.c-success  { color: rgb(var(--color-success-rgb)); }
.c-warning  { color: rgb(var(--color-warning-rgb)); }
.c-danger   { color: rgb(var(--color-danger-rgb)); }
.c-info     { color: rgb(var(--color-info-rgb)); }

/* Type Scale */
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md   { font-size: var(--text-md); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }


/* ==========================================================================
   5. BACKGROUND UTILITIES
========================================================================== */

.bg-base         { background-color: rgb(var(--color-bg-base-rgb)); }
.bg-surface      { background-color: rgb(var(--color-bg-surface-rgb)); }
.bg-surface1     { background-color: rgb(var(--color-bg-surface1-rgb)); }
.bg-surface2     { background-color: rgb(var(--color-bg-surface2-rgb)); }
.bg-card         { background-color: rgb(var(--color-bg-card-rgb)); }

.bg-primary-soft   { background-color: rgb(var(--color-primary-rgb) / .08); }
.bg-secondary-soft { background-color: rgb(var(--color-secondary-rgb) / .08); }
.bg-accent-soft    { background-color: rgb(var(--color-accent-rgb) / .08); }
.bg-success-soft   { background-color: rgb(var(--color-success-rgb) / .08); }
.bg-warning-soft   { background-color: rgb(var(--color-warning-rgb) / .10); }
.bg-danger-soft    { background-color: rgb(var(--color-danger-rgb) / .08); }
.bg-info-soft      { background-color: rgb(var(--color-info-rgb) / .08); }


/* ==========================================================================
   6. BORDER UTILITIES
========================================================================== */

.border-default      { border-color: rgb(var(--color-border-default-rgb)); }
.border-muted        { border-color: rgb(var(--color-border-muted-rgb)); }
.border-strong       { border-color: rgb(var(--color-border-strong-rgb)); }
.border-primary-soft { border-color: rgb(var(--color-primary-rgb) / .2); }
.border-danger-soft  { border-color: rgb(var(--color-danger-rgb) / .2); }


/* ==========================================================================
   7. ELEVATION
========================================================================== */

.elevation-0 { box-shadow: var(--elevation-0); }
.elevation-1 { box-shadow: var(--elevation-1); }
.elevation-2 { box-shadow: var(--elevation-2); }
.elevation-3 { box-shadow: var(--elevation-3); }
.elevation-4 { box-shadow: var(--elevation-4); }


/* ==========================================================================
   8. CARD
========================================================================== */

.card {
  background-color: rgb(var(--color-bg-card-rgb));
  border: 1px solid rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-1);
}

.card-padded { padding: 1.5rem; }

.card-interactive {
  cursor: pointer;
  transition:
    border-color var(--duration-normal) var(--ease-standard),
    box-shadow   var(--duration-normal) var(--ease-standard),
    transform    var(--duration-normal) var(--ease-standard);
}

.card-interactive:hover {
  border-color: rgb(var(--color-primary-rgb) / 0.2);
  box-shadow: var(--elevation-3);
  transform: translateY(-3px);
}

.card-interactive:active {
  transform: translateY(-1px);
  box-shadow: var(--elevation-2);
}


/* ==========================================================================
   9. BUTTON
========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color     var(--duration-fast) var(--ease-standard),
    color            var(--duration-fast) var(--ease-standard),
    box-shadow       var(--duration-fast) var(--ease-standard),
    transform        var(--duration-fast) var(--ease-standard),
    opacity          var(--duration-fast) var(--ease-standard);
}

/* focus-visible: btn 전용 override (outline-offset 줄임) */
.btn:focus-visible {
  outline: 2px solid rgb(var(--color-primary-rgb));
  outline-offset: 2px;
}

.btn:active { transform: scale(0.97); }

.btn:disabled,
.btn[aria-disabled="true"],
.btn-disabled {
  opacity: var(--state-disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

/* Sizes */
.btn-xs { height: 1.875rem; padding: 0 0.625rem; font-size: var(--text-xs);  border-radius: var(--radius-sm); }
.btn-sm { height: 2.25rem;  padding: 0 0.875rem; font-size: var(--text-sm);  border-radius: var(--radius-sm); }
.btn-md { height: 2.75rem;  padding: 0 1.125rem; font-size: var(--text-base); }
.btn-lg { height: 3.25rem;  padding: 0 1.625rem; font-size: var(--text-lg);  border-radius: var(--radius-lg); }

/* Variants */
.btn-primary {
  background-color: rgb(var(--color-primary-rgb));
  color: rgb(var(--color-on-primary-rgb));
}
.btn-primary:hover {
  background-color: rgb(var(--color-primary-rgb) / calc(1 - var(--state-hover-opacity)));
  box-shadow: 0 4px 14px rgb(var(--color-primary-rgb) / 0.3);
}
.btn-primary:active {
  background-color: rgb(var(--color-primary-rgb) / calc(1 - var(--state-pressed-opacity)));
}

.btn-secondary {
  background-color: rgb(var(--color-secondary-rgb));
  color: rgb(var(--color-on-secondary-rgb));
}
.btn-secondary:hover {
  background-color: rgb(var(--color-secondary-rgb) / calc(1 - var(--state-hover-opacity)));
}

.btn-accent {
  background-color: rgb(var(--color-accent-rgb));
  color: rgb(var(--color-on-accent-rgb));
}
.btn-accent:hover {
  box-shadow: 0 4px 14px rgb(var(--color-accent-rgb) / 0.3);
  background-color: rgb(var(--color-accent-rgb) / calc(1 - var(--state-hover-opacity)));
}

.btn-danger {
  background-color: rgb(var(--color-danger-rgb));
  color: rgb(var(--color-on-danger-rgb));
}
.btn-danger:hover {
  background-color: rgb(var(--color-danger-rgb) / calc(1 - var(--state-hover-opacity)));
  box-shadow: 0 4px 14px rgb(var(--color-danger-rgb) / 0.25);
}

.btn-outline {
  background-color: transparent;
  border-color: rgb(var(--color-border-default-rgb));
  color: rgb(var(--color-text-main-rgb));
}
.btn-outline:hover {
  background-color: rgb(var(--color-text-main-rgb) / var(--state-hover-opacity));
  border-color: rgb(var(--color-border-strong-rgb));
}

.btn-soft {
  background-color: rgb(var(--color-primary-rgb) / 0.08);
  color: rgb(var(--color-primary-rgb));
}
.btn-soft:hover {
  background-color: rgb(var(--color-primary-rgb) / 0.13);
}

.btn-ghost {
  background-color: transparent;
  color: rgb(var(--color-text-muted-rgb));
}
.btn-ghost:hover {
  background-color: rgb(var(--color-text-main-rgb) / var(--state-hover-opacity));
  color: rgb(var(--color-text-main-rgb));
}

.btn-full { width: 100%; }

/* Icon-only 버튼 */
.btn-icon {
  padding: 0;
  aspect-ratio: 1;
}
.btn-icon.btn-xs { width: 1.875rem; }
.btn-icon.btn-sm { width: 2.25rem; }
.btn-icon.btn-md { width: 2.75rem; }
.btn-icon.btn-lg { width: 3.25rem; }


/* ==========================================================================
   10. FORM
========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: rgb(var(--color-text-main-rgb) / 0.9);
}

.label-required::after {
  content: " *";
  color: rgb(var(--color-danger-rgb));
}

.input,
.textarea,
.select {
  width: 100%;
  appearance: none;
  background-color: rgb(var(--color-bg-base-rgb));
  border: 1px solid rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-md);
  color: rgb(var(--color-text-main-rgb));
  font-size: var(--text-base);
  transition:
    border-color  var(--duration-fast) var(--ease-standard),
    box-shadow    var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.input::placeholder,
.textarea::placeholder {
  color: rgb(var(--color-text-subtle-rgb));
}

/* 인풋 hover */
.input:hover,
.textarea:hover,
.select:hover {
  border-color: rgb(var(--color-border-strong-rgb));
}

/* 인풋 focus */
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: rgb(var(--color-primary-rgb));
  box-shadow: 0 0 0 4px rgb(var(--color-primary-rgb) / var(--state-focused-opacity));
}

/* Sizes */
.input-sm, .select-sm { height: 2.25rem; padding: 0 0.75rem;  font-size: var(--text-sm);  border-radius: var(--radius-sm); }
.input-md, .select-md { height: 2.75rem; padding: 0 0.875rem; font-size: var(--text-base); }
.input-lg, .select-lg { height: 3.25rem; padding: 0 1.125rem; font-size: var(--text-lg);   border-radius: var(--radius-lg); }

.textarea {
  min-height: 7.5rem;
  padding: 0.75rem 0.875rem;
  resize: vertical;
  line-height: 1.6;
}

/* States */
.input-error {
  border-color: rgb(var(--color-danger-rgb));
}
.input-error:focus {
  box-shadow: 0 0 0 4px rgb(var(--color-danger-rgb) / var(--state-focused-opacity));
}

.input-success {
  border-color: rgb(var(--color-success-rgb));
}
.input-success:focus {
  box-shadow: 0 0 0 4px rgb(var(--color-success-rgb) / var(--state-focused-opacity));
}

/* Help / Error text */
.help-text  { font-size: var(--text-sm); color: rgb(var(--color-text-muted-rgb)); }
.error-text { font-size: var(--text-sm); color: rgb(var(--color-danger-rgb)); font-weight: 500; }


/* ==========================================================================
   11. CHECKBOX / RADIO
========================================================================== */

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: var(--text-base);
  color: rgb(var(--color-text-main-rgb) / 0.9);
  cursor: pointer;
  user-select: none;
}

.checkbox,
.radio {
  appearance: none;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  background-color: rgb(var(--color-bg-base-rgb));
  border: 1.5px solid rgb(var(--color-border-strong-rgb));
  cursor: pointer;
  display: grid;
  place-content: center;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color     var(--duration-fast) var(--ease-standard),
    box-shadow       var(--duration-fast) var(--ease-standard);
}

.checkbox { border-radius: var(--radius-xs); }
.radio    { border-radius: var(--radius-full); }

.checkbox:hover,
.radio:hover {
  border-color: rgb(var(--color-primary-rgb));
}

.checkbox:focus-visible,
.radio:focus-visible {
  box-shadow: 0 0 0 4px rgb(var(--color-primary-rgb) / var(--state-focused-opacity));
  outline: none;
}

.checkbox::before,
.radio::before {
  content: "";
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease-decel);
  background-color: rgb(var(--color-on-primary-rgb));
}

.checkbox::before {
  width: 0.625rem;
  height: 0.625rem;
  clip-path: polygon(14% 44%, 0 58%, 38% 96%, 100% 16%, 86% 2%, 38% 68%);
}

.radio::before {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: var(--radius-full);
}

.checkbox:checked,
.radio:checked {
  background-color: rgb(var(--color-primary-rgb));
  border-color: rgb(var(--color-primary-rgb));
}

.checkbox:checked::before,
.radio:checked::before {
  transform: scale(1);
}


/* ==========================================================================
   12. SWITCH
========================================================================== */

/* 사용법: <label><input class="switch-input" type="checkbox"><span class="switch"></span></label> */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  background-color: rgb(var(--color-border-strong-rgb));
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
  flex-shrink: 0;
}

.switch::after {
  content: "";
  width: 1.125rem;
  height: 1.125rem;
  border-radius: var(--radius-full);
  background-color: rgb(var(--color-bg-card-rgb));
  box-shadow: 0 1px 4px rgb(var(--color-shadow-rgb) / 0.2);
  transform: translateX(0.1875rem);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-input:checked + .switch {
  background-color: rgb(var(--color-primary-rgb));
}

.switch-input:checked + .switch::after {
  transform: translateX(1.4375rem);
}

.switch-input:focus-visible + .switch {
  box-shadow: 0 0 0 4px rgb(var(--color-primary-rgb) / var(--state-focused-opacity));
}

.switch-input:disabled + .switch {
  opacity: var(--state-disabled-opacity);
  cursor: not-allowed;
}


/* ==========================================================================
   13. BADGE
========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.badge-sm { padding: 0.1875rem 0.5rem;  font-size: var(--text-xs);  }
.badge-md { padding: 0.3125rem 0.6875rem; font-size: var(--text-sm);  }

.badge-primary   { background-color: rgb(var(--color-primary-rgb) / .08);   color: rgb(var(--color-primary-rgb));   border-color: rgb(var(--color-primary-rgb) / .15);   }
.badge-secondary { background-color: rgb(var(--color-secondary-rgb) / .08); color: rgb(var(--color-secondary-rgb)); border-color: rgb(var(--color-secondary-rgb) / .15); }
.badge-accent    { background-color: rgb(var(--color-accent-rgb) / .08);    color: rgb(var(--color-accent-rgb));    border-color: rgb(var(--color-accent-rgb) / .15);    }
.badge-success   { background-color: rgb(var(--color-success-rgb) / .08);   color: rgb(var(--color-success-rgb));   border-color: rgb(var(--color-success-rgb) / .15);   }
.badge-warning   { background-color: rgb(var(--color-warning-rgb) / .10);   color: rgb(var(--color-warning-rgb));   border-color: rgb(var(--color-warning-rgb) / .18);   }
.badge-danger    { background-color: rgb(var(--color-danger-rgb) / .08);    color: rgb(var(--color-danger-rgb));    border-color: rgb(var(--color-danger-rgb) / .15);    }
.badge-info      { background-color: rgb(var(--color-info-rgb) / .08);      color: rgb(var(--color-info-rgb));      border-color: rgb(var(--color-info-rgb) / .15);      }


/* ==========================================================================
   14. ALERT
========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-base);
  line-height: 1.55;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 0.0625rem;
}

.alert-info    { background-color: rgb(var(--color-info-rgb) / .06);    border-color: rgb(var(--color-info-rgb) / .18);    color: rgb(var(--color-info-rgb)); }
.alert-success { background-color: rgb(var(--color-success-rgb) / .06); border-color: rgb(var(--color-success-rgb) / .18); color: rgb(var(--color-success-rgb)); }
.alert-warning { background-color: rgb(var(--color-warning-rgb) / .08); border-color: rgb(var(--color-warning-rgb) / .20); color: rgb(var(--color-warning-rgb)); }
.alert-danger  { background-color: rgb(var(--color-danger-rgb) / .06);  border-color: rgb(var(--color-danger-rgb) / .18);  color: rgb(var(--color-danger-rgb)); }


/* ==========================================================================
   15. NAV
========================================================================== */

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgb(var(--color-text-muted-rgb));
  font-weight: 500;
  font-size: var(--text-md);
  transition: color var(--duration-fast) var(--ease-standard);
}

.nav-link:hover,
.nav-link-active {
  color: rgb(var(--color-text-main-rgb));
}

.nav-pill {
  padding: 0.4375rem 0.875rem;
  border-radius: var(--radius-md);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    color            var(--duration-fast) var(--ease-standard);
}

.nav-pill:hover {
  background-color: rgb(var(--color-text-main-rgb) / var(--state-hover-opacity));
}

.nav-pill-active {
  background-color: rgb(var(--color-primary-rgb) / 0.08);
  color: rgb(var(--color-primary-rgb));
  font-weight: 600;
}


/* ==========================================================================
   16. TABS
========================================================================== */

.tabs {
  display: flex;
  gap: 0.125rem;
  border-bottom: 1px solid rgb(var(--color-border-default-rgb));
}

.tab {
  padding: 0.6875rem 1rem;
  font-size: var(--text-base);
  font-weight: 600;
  color: rgb(var(--color-text-muted-rgb));
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition:
    color        var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.tab:hover {
  color: rgb(var(--color-text-main-rgb));
}

.tab-active {
  color: rgb(var(--color-primary-rgb));
  border-bottom-color: rgb(var(--color-primary-rgb));
}


/* ==========================================================================
   17. TABLE
========================================================================== */

.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-1);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--text-base);
}

.table th {
  background-color: rgb(var(--color-bg-surface-rgb));
  color: rgb(var(--color-text-muted-rgb));
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgb(var(--color-border-default-rgb));
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgb(var(--color-border-muted-rgb));
  color: rgb(var(--color-text-main-rgb) / 0.85);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-hover tbody tr {
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.table-hover tbody tr:hover {
  background-color: rgb(var(--color-text-main-rgb) / 0.025);
}


/* ==========================================================================
   18. MODAL / OVERLAY
========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  background-color: rgb(var(--color-overlay-rgb) / 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 40;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(calc(100vw - 2rem), 34rem);
  transform: translate(-50%, -50%);
  background-color: rgb(var(--color-bg-card-rgb));
  border: 1px solid rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-4);
  z-index: 50;
  overflow: hidden;
}


/* ==========================================================================
   19. DROPDOWN
========================================================================== */

.dropdown {
  background-color: rgb(var(--color-bg-card-rgb));
  border: 1px solid rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-3);
  padding: 0.3125rem;
  min-width: 12rem;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.875rem;
  color: rgb(var(--color-text-main-rgb) / 0.8);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    color            var(--duration-fast) var(--ease-standard);
}

.dropdown-item:hover {
  background-color: rgb(var(--color-bg-surface-rgb));
  color: rgb(var(--color-text-main-rgb));
}

.dropdown-item-danger {
  color: rgb(var(--color-danger-rgb) / 0.9);
}
.dropdown-item-danger:hover {
  background-color: rgb(var(--color-danger-rgb) / .06);
  color: rgb(var(--color-danger-rgb));
}

.dropdown-divider {
  height: 1px;
  background-color: rgb(var(--color-border-muted-rgb));
  margin: 0.3125rem 0;
}


/* ==========================================================================
   20. PAGINATION
========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.125rem;
  height: 2.125rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgb(var(--color-text-muted-rgb));
  border: 1px solid rgb(var(--color-border-default-rgb));
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color     var(--duration-fast) var(--ease-standard),
    color            var(--duration-fast) var(--ease-standard);
}

.page-link:hover {
  background-color: rgb(var(--color-bg-surface-rgb));
  color: rgb(var(--color-text-main-rgb));
  border-color: rgb(var(--color-border-strong-rgb));
}

.page-link-active {
  background-color: rgb(var(--color-primary-rgb));
  color: rgb(var(--color-on-primary-rgb));
  border-color: rgb(var(--color-primary-rgb));
  pointer-events: none;
}

.page-link:disabled,
.page-link[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}


/* ==========================================================================
   21. AVATAR
========================================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-full);
  background-color: rgb(var(--color-primary-rgb) / 0.1);
  color: rgb(var(--color-primary-rgb));
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-sm { width: 1.875rem; height: 1.875rem; font-size: var(--text-xs); }
.avatar-md { width: 2.375rem; height: 2.375rem; font-size: var(--text-sm); }
.avatar-lg { width: 3.25rem;  height: 3.25rem;  font-size: var(--text-lg); }

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-ring {
  box-shadow: 0 0 0 2px rgb(var(--color-bg-card-rgb)), 0 0 0 4px rgb(var(--color-primary-rgb));
}

/* Avatar 색상 변형 */
.avatar-secondary { background-color: rgb(var(--color-secondary-rgb) / .1); color: rgb(var(--color-secondary-rgb)); }
.avatar-accent    { background-color: rgb(var(--color-accent-rgb) / .1);    color: rgb(var(--color-accent-rgb)); }
.avatar-success   { background-color: rgb(var(--color-success-rgb) / .1);   color: rgb(var(--color-success-rgb)); }
.avatar-warning   { background-color: rgb(var(--color-warning-rgb) / .12);  color: rgb(var(--color-warning-rgb)); }
.avatar-danger    { background-color: rgb(var(--color-danger-rgb) / .1);    color: rgb(var(--color-danger-rgb)); }


/* ==========================================================================
   22. TOAST
========================================================================== */

.toast-region {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 22rem;
  padding: 0.875rem 1rem;
  background-color: rgb(var(--color-bg-card-rgb));
  border: 1px solid rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-3);
  font-size: var(--text-base);
  pointer-events: auto;
}

.toast-success { border-left: 3px solid rgb(var(--color-success-rgb)); }
.toast-warning { border-left: 3px solid rgb(var(--color-warning-rgb)); }
.toast-danger  { border-left: 3px solid rgb(var(--color-danger-rgb));  }
.toast-info    { border-left: 3px solid rgb(var(--color-info-rgb));    }


/* ==========================================================================
   23. EMPTY STATE
========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1.5px dashed rgb(var(--color-border-strong-rgb));
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  color: rgb(var(--color-text-muted-rgb));
}

.empty-state-icon {
  color: rgb(var(--color-text-subtle-rgb));
  margin-bottom: 1rem;
}

.empty-state-title {
  color: rgb(var(--color-text-main-rgb));
  font-weight: 700;
  font-size: var(--text-xl);
}

.empty-state-description {
  margin-top: 0.375rem;
  color: rgb(var(--color-text-muted-rgb));
  font-size: var(--text-base);
  max-width: 28rem;
}


/* ==========================================================================
   24. PROGRESS
========================================================================== */

.progress {
  width: 100%;
  height: 0.4375rem;
  background-color: rgb(var(--color-border-default-rgb));
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background-color: rgb(var(--color-primary-rgb));
  transition: width var(--duration-slow) var(--ease-decel);
}

.progress-bar-success { background-color: rgb(var(--color-success-rgb)); }
.progress-bar-warning { background-color: rgb(var(--color-warning-rgb)); }
.progress-bar-danger  { background-color: rgb(var(--color-danger-rgb)); }

/* 두께 변형 */
.progress-xs  { height: 0.1875rem; }
.progress-sm  { height: 0.375rem; }
.progress-lg  { height: 0.75rem; }


/* ==========================================================================
   25. SKELETON
========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    rgb(var(--color-text-main-rgb) / 0.04) 25%,
    rgb(var(--color-text-main-rgb) / 0.09) 37%,
    rgb(var(--color-text-main-rgb) / 0.04) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0%   { background-position: 100% 0; }
  100% { background-position: -300% 0; }
}


/* ==========================================================================
   26. DIVIDER
========================================================================== */

.divider {
  height: 1px;
  background-color: rgb(var(--color-border-muted-rgb));
}

.divider-default {
  background-color: rgb(var(--color-border-default-rgb));
}


/* ==========================================================================
   27. TOOLTIP (신규)
========================================================================== */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background-color: rgb(var(--color-text-main-rgb));
  color: rgb(var(--color-bg-base-rgb));
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 0.3125rem 0.625rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity   var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
