/* 공통 부품 — 색은 테마 변수(--c-*)를 따른다 */
:root {
  --c-primary: #14402f; --c-on-primary: #fff; --c-accent: #d6f04a; --c-on-accent: #111;
  --c-bg: #f4f2eb; --c-surface: #fff; --c-ink: #141a17; --c-muted: #7b8079; --c-line: #e2e0d8; --c-soft: #e6ebe5; --c-band: #0d1110;
  --c-ok: #1f8a52; --c-warn: #b45309; --c-danger: #c0362c;
  --radius: 18px; --font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; --font-head: var(--font);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.18);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-ink); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img, video { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -0.03em; line-height: 1.2; margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--c-muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: calc(var(--radius) * .7); border: 1px solid var(--c-line); background: var(--c-surface); font-weight: 650; cursor: pointer; text-decoration: none; transition: transform .15s, background .2s, opacity .2s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--c-primary); color: var(--c-on-primary); border-color: transparent; }
.btn.accent { background: var(--c-accent); color: var(--c-on-accent); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--c-danger); border-color: color-mix(in srgb, var(--c-danger) 40%, transparent); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16.5px; }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label { font-size: 13px; font-weight: 650; color: var(--c-muted); }
.field small { color: var(--c-muted); font-size: 12px; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: calc(var(--radius) * .6); border: 1px solid var(--c-line); background: var(--c-surface); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 18%, transparent); }
.ts-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ts-row.end { justify-content: flex-end; }
.ts-row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 550; }
.check input { width: 18px; height: 18px; accent-color: var(--c-primary); }

/* 선택 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--c-line); background: var(--c-surface); cursor: pointer; font-weight: 600; font-size: 14px; transition: all .15s; }
.chip input:checked + span { background: var(--c-primary); color: var(--c-on-primary); border-color: var(--c-primary); }
.chip input:disabled + span { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 30%, transparent); }

/* 카드·배지 */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 18px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; background: var(--c-soft); color: var(--c-primary); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--c-ok) 14%, transparent); color: var(--c-ok); }
.badge.warn { background: color-mix(in srgb, var(--c-warn) 14%, transparent); color: var(--c-warn); }
.badge.danger { background: color-mix(in srgb, var(--c-danger) 12%, transparent); color: var(--c-danger); }
.badge.dim { background: color-mix(in srgb, var(--c-ink) 8%, transparent); color: var(--c-muted); }
.badge.accent { background: var(--c-accent); color: var(--c-on-accent); }
.empty { text-align: center; color: var(--c-muted); padding: 48px 16px; }

/* 토스트·모달 */
.ts-toasts { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.ts-toast { background: #15191a; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 550; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: ts-in .25s ease both; max-width: 460px; text-align: center; }
.ts-toast.err { background: #b3261e; } .ts-toast.ok { background: #1f6f45; }
.ts-toast.out { opacity: 0; transform: translateY(6px); transition: all .4s; }
@keyframes ts-in { from { opacity: 0; transform: translateY(8px); } }
.ts-modal { position: fixed; inset: 0; z-index: 9000; background: rgba(8,10,10,.55); display: flex; align-items: flex-end; justify-content: center; animation: ts-fade .2s both; backdrop-filter: blur(3px); }
@keyframes ts-fade { from { opacity: 0; } }
.ts-modal-card { position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--c-surface); color: var(--c-ink); border-radius: 22px 22px 0 0; padding: 26px 20px 22px; animation: ts-up .28s cubic-bezier(.2,.8,.2,1) both; }
.ts-modal-card.wide { max-width: 760px; }
@keyframes ts-up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 640px) { .ts-modal { align-items: center; } .ts-modal-card { border-radius: 22px; } }
.ts-x { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--c-muted); }
.ts-confirm-msg { font-size: 16px; font-weight: 600; margin: 6px 0 20px; }

/* 표 */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--c-muted); font-weight: 700; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
