/* medikit × HTMX — 빌드 없는 순수 CSS (medikit 1.3.0 값). 이 파일 하나만 링크하면 된다.
 * 브랜드 색을 바꾸려면 :root 의 --ms-primary* 만 바꾼다. 글꼴은 Pretendard (없으면 시스템 글꼴). */

:root {
  --ms-primary: #20c8d6; --ms-primary-100: #e8f8fa; --ms-primary-300: #c8f0f4; --ms-primary-500: #88e8f0;
  --ms-primary-600: #1aa8b4; --ms-primary-700: #148a94;
  --ms-red: #ff4e51; --ms-red-100: #ffefef; --ms-red-500: #ffc4c5;
  --ms-yellow: #fd9400; --ms-yellow-100: #fff7ec;
  --ms-purple: #ac47ff; --ms-purple-100: #f8f0ff;
  --ms-white: #fff; --ms-black: #000; --ms-overlay: rgba(0, 0, 0, .6);
  --ms-gray-100: #fbfbfb; --ms-gray-200: #f3f3f3; --ms-gray-300: #e3e3e3; --ms-gray-400: #d6d6d6;
  --ms-gray-500: #cfcfcf; --ms-gray-600: #9f9f9f; --ms-gray-700: #6e6e6e; --ms-gray-800: #3e3e3e;
  --ms-text: var(--ms-gray-800);
  --ms-text-secondary: var(--ms-gray-700);
  --ms-font: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--ms-white); color: var(--ms-text); font-family: var(--ms-font); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ── 글자 (text-typo-*) ── */
.ms-t-title-sm { font-size: 18px; font-weight: 600; line-height: 1.5; color: var(--ms-black); }
.ms-t-heading-md { font-size: 16px; font-weight: 500; line-height: 1.5; }
.ms-t-heading-sm { font-size: 14px; font-weight: 500; line-height: 1.5; }
.ms-t-body { font-size: 14px; font-weight: 500; line-height: 1.6; color: var(--ms-black); }
.ms-t-caption { font-size: 12px; font-weight: 400; line-height: 1.3; color: var(--ms-gray-700); }
.ms-muted { color: var(--ms-gray-600); }

/* ── Button: <button class="ms-btn ms-btn--primary ms-btn--l"> ── */
.ms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: 10px; background: none; font-size: 14px; font-weight: 500; line-height: 1.5; text-decoration: none; transition: background-color .15s, color .15s; }
.ms-btn--primary { background: var(--ms-primary); color: #fff; }
.ms-btn--primary:hover { background: var(--ms-primary-500); }
.ms-btn--outline { background: #fff; border-color: var(--ms-primary-500); color: var(--ms-primary); }
.ms-btn--outline:hover { background: var(--ms-primary-100); }
.ms-btn--gray { background: #fff; border-color: var(--ms-gray-300); color: var(--ms-gray-600); }
.ms-btn--gray:hover { background: var(--ms-gray-100); }
.ms-btn--danger { background: #fff; border-color: var(--ms-red-500); color: var(--ms-red); }
.ms-btn--danger:hover { background: var(--ms-red-100); }
.ms-btn--filled { background: var(--ms-primary-100); color: var(--ms-primary); }
.ms-btn--filled:hover { background: var(--ms-primary-300); }
.ms-btn--text { padding: 0; color: var(--ms-gray-600); }
.ms-btn--text:hover { color: var(--ms-gray-800); }
.ms-btn--l { height: 44px; gap: 6px; padding: 0 16px; font-size: 16px; border-radius: 8px; }
.ms-btn--input { height: 36px; border-radius: 6px; }
.ms-btn--s { height: 33px; border-radius: 6px; }
.ms-btn--ss { height: 28px; padding: 0 8px; font-size: 12px; border-radius: 4px; }
.ms-btn--block { flex: 1; }
.ms-btn:disabled { cursor: not-allowed; background: var(--ms-gray-300); border-color: transparent; color: #fff; }
.ms-btn:focus-visible { outline: 2px solid var(--ms-primary); outline-offset: 2px; }

/* ── Input / Select: 바깥 .ms-input 이 테두리, 안쪽 input/select 는 테두리 없음 ── */
.ms-field { display: flex; flex-direction: column; gap: 6px; }
.ms-label { font-size: 14px; font-weight: 500; line-height: 1.6; color: var(--ms-black); }
.ms-hint { font-size: 12px; color: var(--ms-gray-700); }
.ms-input { display: flex; align-items: center; gap: 16px; height: 44px; padding: 0 16px; border: 1px solid var(--ms-gray-300); border-radius: 8px; background: #fff; overflow: hidden; }
.ms-input--m { height: 36px; }
.ms-input:focus-within { border-color: var(--ms-primary); }
.ms-input--error { border-color: var(--ms-red); }
.ms-input > input, .ms-input > select { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 400; color: var(--ms-gray-800); text-overflow: ellipsis; }
.ms-input > input::placeholder { color: var(--ms-gray-600); }
.ms-input > input:read-only, .ms-input > input:disabled { color: var(--ms-gray-600); }
.ms-input > select { appearance: none; cursor: pointer; }
.ms-input > .ms-icon { color: var(--ms-gray-600); }

/* ── Checkbox / Radio: <input type="checkbox" class="ms-checkbox"> ── */
.ms-checkbox, .ms-radio { appearance: none; width: 16px; height: 16px; flex: none; margin: 0; border: 1px solid var(--ms-gray-300); background: #fff center / 12px no-repeat; cursor: pointer; transition: background-color .15s; }
.ms-checkbox { border-radius: 4px; }
.ms-checkbox:checked { border-color: transparent; background-color: var(--ms-primary); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4 10L8 14L16 6' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ms-radio { border-radius: 50%; }
.ms-radio:checked { border: 5px solid var(--ms-primary); }
.ms-checkbox:disabled, .ms-radio:disabled { cursor: not-allowed; background-color: var(--ms-gray-200); }
.ms-checkbox:focus-visible, .ms-radio:focus-visible { outline: 2px solid var(--ms-primary); outline-offset: 2px; }

/* ── Badge / Chip ── */
.ms-badge { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--ms-gray-200); color: var(--ms-gray-800); font-size: 12px; font-weight: 500; white-space: nowrap; }
.ms-badge--sm { height: 24px; padding: 0 8px; font-size: 10px; }
.ms-badge--primary { background: var(--ms-primary-100); color: var(--ms-primary); }
.ms-badge--warning { background: var(--ms-yellow-100); color: var(--ms-yellow); }
.ms-badge--danger { background: var(--ms-red-100); color: var(--ms-red); }
.ms-badge--purple { background: var(--ms-purple-100); color: var(--ms-purple); }
.ms-chip { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .04); color: var(--ms-gray-800); font-size: 14px; font-weight: 500; transition: background-color .15s; }
.ms-chip:hover { background: rgba(0, 0, 0, .08); }
.ms-chip[aria-pressed="true"], .ms-chip.is-active { background: var(--ms-primary-100); color: var(--ms-primary); }

/* ── Banner: <div class="ms-banner ms-banner--danger" role="alert"> ── */
.ms-banner { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 20px; border-radius: 10px; background: var(--ms-primary-100); font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--ms-gray-800); }
.ms-banner::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; background: var(--ms-primary); }
.ms-banner--warning { background: var(--ms-yellow-100); } .ms-banner--warning::before { background: var(--ms-yellow); }
.ms-banner--danger { background: var(--ms-red-100); } .ms-banner--danger::before { background: var(--ms-red); }
.ms-banner--neutral { background: var(--ms-gray-200); } .ms-banner--neutral::before { background: var(--ms-gray-600); }

/* ── Card / Table ── */
.ms-card { border: 1px solid var(--ms-gray-200); border-radius: 12px; background: #fff; padding: 20px; }
.ms-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ms-card__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--ms-text); }
.ms-table-wrap { overflow: auto; border: 1px solid var(--ms-gray-200); border-radius: 12px; background: #fff; }
.ms-table { width: 100%; border-collapse: collapse; font-size: 12px; color: var(--ms-text); }
.ms-table th { position: sticky; top: 0; z-index: 1; padding: 10px 16px; border-bottom: 1px solid var(--ms-gray-300); background: var(--ms-primary-100); text-align: left; font-weight: 600; white-space: nowrap; color: var(--ms-text-secondary); }
.ms-table td { max-width: 280px; padding: 12px 16px; border-top: 1px solid var(--ms-gray-200); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-table tbody tr:hover { background: var(--ms-gray-100); }
.ms-table .ms-right { text-align: right; }
.ms-empty { padding: 48px 0; border: 1px solid var(--ms-gray-200); border-radius: 12px; text-align: center; color: var(--ms-gray-600); }

/* ── Modal: <dialog class="ms-modal" data-open-on-load> ── */
.ms-modal { width: 560px; max-width: calc(100vw - 32px); margin: auto; padding: 0; border: 0; border-radius: 16px; background: #fff; color: var(--ms-text); }
.ms-modal::backdrop { background: var(--ms-overlay); }
.ms-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 24px 0; }
.ms-modal__title { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.5; color: var(--ms-black); }
.ms-modal__close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--ms-gray-600); }
.ms-modal__close:hover { background: var(--ms-gray-100); }
.ms-modal__body { display: flex; flex-direction: column; gap: 16px; padding: 20px 24px; }
.ms-modal__foot { display: flex; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--ms-gray-200); }

/* ── 앱 셸: 탭(38) · 헤더(57) · 사이드바(274) · main ── */
.ms-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.ms-tabs { display: flex; align-items: flex-end; gap: 12px; height: 38px; flex: none; padding: 6px 32px 0; background: var(--ms-gray-200); }
.ms-tab { position: relative; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 14px 14px 0 0; color: var(--ms-gray-700); font-size: 14px; font-weight: 500; text-decoration: none; }
.ms-tab:hover { background: var(--ms-gray-100); }
.ms-tab[aria-current="page"] { z-index: 1; background: #fff; color: var(--ms-black); box-shadow: 0 -3px 6px -2px rgba(0, 0, 0, .05); }
.ms-tab[aria-current="page"]::before, .ms-tab[aria-current="page"]::after { content: ""; position: absolute; bottom: 0; width: 14px; height: 14px; }
.ms-tab[aria-current="page"]::before { left: -14px; background: radial-gradient(circle at 0 0, transparent 14px, #fff 14.5px); }
.ms-tab[aria-current="page"]::after { right: -14px; background: radial-gradient(circle at 100% 0, transparent 14px, #fff 14.5px); }
.ms-header { display: flex; align-items: center; justify-content: space-between; height: 57px; flex: none; padding: 0 42px; border-bottom: 1px solid var(--ms-gray-200); background: #fff; }
.ms-header__right { display: flex; align-items: center; gap: 16px; }
.ms-body { display: flex; flex: 1; min-height: 0; }
.ms-side { display: flex; flex-direction: column; flex: none; width: 274px; padding: 26px 16px; border-right: 1px solid var(--ms-gray-200); background: #fff; }
.ms-nav { display: flex; flex-direction: column; gap: 16px; }
.ms-nav__group { margin: 0; padding: 0 10px; font-size: 14px; font-weight: 400; color: var(--ms-gray-600); }
.ms-nav__item { display: flex; align-items: center; gap: 16px; width: 100%; height: 40px; padding: 0 16px; border-radius: 8px; color: var(--ms-gray-700); font-size: 16px; font-weight: 400; text-decoration: none; white-space: nowrap; transition: background-color .15s; }
.ms-nav__item:hover { background: var(--ms-gray-100); }
.ms-nav__item .ms-icon { color: var(--ms-gray-600); }
.ms-nav__item[aria-current="page"] { background: var(--ms-primary-100); color: var(--ms-primary); font-weight: 500; }
.ms-nav__item[aria-current="page"] .ms-icon { color: var(--ms-primary); }
.ms-main { display: flex; flex: 1; flex-direction: column; min-width: 0; overflow: hidden; background: var(--ms-gray-100); }
.ms-page { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.ms-page__head { display: flex; flex-direction: column; gap: 4px; flex: none; padding: 24px 28px 16px; background: #fff; }
.ms-page__title { margin: 0; font-size: 20px; font-weight: 700; color: var(--ms-text); }
.ms-page__desc { margin: 0; font-size: 14px; color: var(--ms-text-secondary); }
.ms-page__body { display: flex; flex: 1; flex-direction: column; gap: 16px; overflow-y: auto; padding: 20px 28px 24px; }
.ms-row { display: flex; align-items: center; gap: 8px; }

/* ── 아이콘(인라인 SVG 의 기본값) · HTMX 진행 표시 ── */
.ms-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms-progress { position: fixed; top: 0; left: 0; z-index: 50; width: 0; height: 3px; background: var(--ms-primary); opacity: 0; transition: width .2s, opacity .2s; }
.ms-progress.is-active { width: 70%; opacity: 1; }
.htmx-request.ms-busy, .htmx-request .ms-busy { pointer-events: none; opacity: .6; }

/* ── 좁은 화면 ── */
@media (max-width: 860px) {
  .ms-header { padding: 0 16px; } .ms-tabs { padding-inline: 12px; }
  .ms-side { width: 84px; padding-inline: 8px; } .ms-nav__item { padding: 0 12px; } .ms-nav__item span, .ms-nav__group { display: none; }
  .ms-page__head, .ms-page__body { padding-inline: 16px; }
}
