/*
 * NORDHEM HQ — 디자인 시스템 (이 파일 하나가 모든 화면의 모양을 정한다)
 * 색: 배경 #f6f7f9 · 카드 흰색 · 글자 #111827 / 보조 #6b7280 · 강조색 딥그린 #1f6f5b 하나
 * 상태색: 성공(초록) · 주의(호박) · 위험(빨강) · 안내(파랑) · 중립(회색) — 배지·알림에 같은 규칙으로 쓴다
 * 간격: 4 / 8 / 12 / 16 / 24 / 32 / 48 · 둥글기: 8(입력·버튼) / 12(카드)
 */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f3f4f6;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #111827;
    --text-2: #374151;
    --muted: #6b7280;
    --faint: #9ca3af;

    --accent: #1f6f5b;
    --accent-hover: #195c4b;
    --accent-active: #144a3d;
    --accent-soft: #eaf4f0;
    --accent-soft-2: #d2e8df;
    --accent-text: #175546;
    --focus-ring: 0 0 0 3px rgba(31, 111, 91, .25);

    --success: #15803d; --success-bg: #ecfdf3; --success-border: #b7ebc6; --success-ink: #14532d;
    --warn: #b45309;    --warn-bg: #fffbeb;    --warn-border: #fcd98a;    --warn-ink: #78350f;
    --danger: #c0262d;  --danger-bg: #fef2f2;  --danger-border: #fcc8c8;  --danger-ink: #7f1d1d;
    --info: #1d4ed8;    --info-bg: #eff6ff;    --info-border: #c3d9fd;    --info-ink: #1e3a8a;
    --neutral: #4b5563; --neutral-bg: #f3f4f6; --neutral-border: #e5e7eb;

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
    --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-full: 999px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 16px 40px rgba(16, 24, 40, .14), 0 3px 8px rgba(16, 24, 40, .06);

    --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Consolas, "D2Coding", monospace;
    --control-h: 40px;
    --sidebar-w: 248px;
    --topbar-h: 56px;
}

/* ───────── 기본 ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
    margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
    font-size: 15px; line-height: 1.55; letter-spacing: -0.008em;
    word-break: keep-all; overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -0.02em; color: var(--text); font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
hr { border: 0; height: 1px; background: var(--border); margin: var(--s5) 0; }
code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; color: var(--text-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft-2); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }

.icon { width: 18px; height: 18px; display: inline-block; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; }
.spin { animation: hq-spin 1s linear infinite; }
@keyframes hq-spin { to { transform: rotate(360deg); } }

/* ───────── 화면 뼈대: 왼쪽 메뉴 + 본문 ───────── */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    display: flex; flex-direction: column; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--border);
}
.app-main { margin-left: var(--sidebar-w); min-width: 0; min-height: 100vh; }
.content { max-width: 1280px; margin: 0 auto; padding: var(--s6) var(--s6) 96px; }
.topbar, .nav-backdrop, .icon-btn.nav-close { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; letter-spacing: 0; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.brand-name { display: block; font-weight: 800; font-size: 15px; letter-spacing: .04em; line-height: 1.2; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.sidebar-cta { padding: 4px 16px 8px; }
.sidebar-cta .btn[aria-current="page"] { box-shadow: 0 0 0 3px var(--accent-soft-2); }
.nav { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; font-weight: 700; color: var(--muted); padding: 18px 12px 6px; letter-spacing: .04em; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 15px; }
.nav-link .icon { width: 19px; height: 19px; color: var(--faint); }
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav-link[aria-current="page"] .icon { color: var(--accent); }
.nav-sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.nav-count { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--r-full); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.sidebar-foot { margin-top: auto; padding: 12px 16px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.sidebar-user { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }

@media (max-width: 1023px) {
    html { scroll-padding-top: calc(var(--topbar-h) + 16px); }
    .sidebar { width: min(300px, 86vw); transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--shadow-lg); visibility: hidden; }
    body.nav-open { overflow: hidden; }
    body.nav-open .sidebar { transform: none; visibility: visible; }
    .nav-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(17, 24, 39, .45); }
    body.nav-open .nav-backdrop { display: block; }
    .icon-btn.nav-close { display: inline-grid; margin-left: auto; }
    .app-main { margin-left: 0; }
    .topbar {
        display: flex; position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
        align-items: center; gap: var(--s2); padding: 0 var(--s3);
        background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
        border-bottom: 1px solid var(--border);
    }
    .topbar .brand { padding: 0; gap: 8px; margin-right: auto; }
    .topbar .brand-mark { width: 30px; height: 30px; font-size: 14px; border-radius: 9px; }
    .content { padding: var(--s5) var(--s4) 96px; }
}
@media (max-width: 380px) { .topbar .brand-name { display: none; } }

/* ───────── 버튼 ───────── */
.btn {
    --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--control-h); padding: 0 16px; border-radius: var(--r-sm);
    border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
    font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1; letter-spacing: -0.01em;
    white-space: nowrap; cursor: pointer; text-decoration: none; user-select: none;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; color: var(--btn-fg); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 17px; height: 17px; vertical-align: 0; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: #fff; --btn-border: var(--accent); box-shadow: 0 1px 2px rgba(20, 74, 61, .25); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-text); --btn-border: transparent; }
.btn-soft:hover { background: var(--accent-soft-2); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-2); --btn-border: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-border: transparent; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-line { --btn-fg: var(--danger); --btn-border: var(--danger-border); }
.btn-danger-line:hover { background: var(--danger-bg); }
.btn-wait { --btn-bg: var(--info-bg); --btn-fg: var(--info); --btn-border: transparent; cursor: default; }
.btn-wait:hover { background: var(--info-bg); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 7px; gap: 5px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-group { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--text-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.icon-btn .icon { width: 22px; height: 22px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ───────── 입력 ───────── */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
    width: 100%; height: var(--control-h); padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 15px; letter-spacing: -0.005em;
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 104px; padding: 10px 12px; line-height: 1.6; resize: vertical; display: block; }
select {
    appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; background-size: 16px;
}
input:hover, select:hover, textarea:hover { border-color: #b4bac3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
input[type=number] { font-variant-numeric: tabular-nums; }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--danger); }
input.is-invalid:focus, textarea.is-invalid:focus { box-shadow: 0 0 0 3px rgba(192, 38, 45, .18); }
input[type=file] { font: inherit; font-size: 14px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
    font: inherit; font-size: 14px; font-weight: 600; height: 36px; padding: 0 14px; margin-right: 10px;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex-shrink: 0; cursor: pointer; }
.input-sm, select.input-sm { height: 32px; font-size: 13.5px; padding: 0 10px; border-radius: 7px; }
select.input-sm { padding-right: 30px; background-position: right 8px center; background-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 600; color: var(--text-2); display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.label .opt { font-size: 13px; font-weight: 500; color: var(--muted); }
.label .req { color: var(--danger); font-weight: 700; }
.hint { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.hint-warn { color: var(--warn); font-weight: 600; }
.field-error { font-size: 13.5px; color: var(--danger); font-weight: 600; }
.form-grid { display: grid; gap: var(--s4) var(--s4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.form-grid > * { grid-column: span 12; }
.form-grid > .w-6 { grid-column: span 6; } .form-grid > .w-4 { grid-column: span 4; } .form-grid > .w-3 { grid-column: span 3; } .form-grid > .w-8 { grid-column: span 8; }
@media (max-width: 767px) {
    .form-grid > .w-6, .form-grid > .w-4, .form-grid > .w-8 { grid-column: span 12; }
    .form-grid > .w-3 { grid-column: span 6; }
}
.affix { position: relative; display: block; }
.affix > input { padding-right: 52px; }
.affix > .affix-text { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--muted); pointer-events: none; }
.inline-number { width: 76px !important; display: inline-block; }

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 15px; line-height: 1.45; color: var(--text); }
.check > input { margin-top: 1px; }
.check-sub { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }

/* 켜고 끄는 스위치 (체크박스 그대로, 모양만) */
input[type=checkbox].switch {
    appearance: none; -webkit-appearance: none; position: relative; width: 42px; height: 24px; margin: 0;
    border-radius: var(--r-full); background: #cfd4dc; cursor: pointer; flex-shrink: 0; transition: background-color .18s;
}
input[type=checkbox].switch::before {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .18s;
}
input[type=checkbox].switch:checked { background: var(--accent); }
input[type=checkbox].switch:checked::before { transform: translateX(18px); }
input[type=checkbox].switch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
input[type=checkbox].switch.switch-sm { width: 36px; height: 20px; }
input[type=checkbox].switch.switch-sm::before { width: 14px; height: 14px; }
input[type=checkbox].switch.switch-sm:checked::before { transform: translateX(16px); }

/* 고르는 카드 (라디오) */
.choices { display: grid; gap: var(--s2); }
.choices.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 767px) { .choices.cols-2 { grid-template-columns: minmax(0, 1fr); } }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s; }
.choice:hover { border-color: #b4bac3; }
.choice > input { margin-top: 2px; }
.choice-title { display: block; font-weight: 700; font-size: 15px; }
.choice-desc { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { box-shadow: inset 0 0 0 1px var(--accent), var(--focus-ring); }

/* 토글 칩 (여러 개 고르기) */
.pills { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pill-check { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-2); transition: border-color .15s, background-color .15s; }
.pill-check:hover { border-color: #b4bac3; }
.pill-check > input { width: 16px; height: 16px; }
.pill-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.pill-check:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* ───────── 상태 배지 ───────── */
.chip {
    display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
    border-radius: var(--r-full); font-size: 12.5px; font-weight: 700; line-height: 1; white-space: nowrap;
    background: var(--neutral-bg); color: var(--neutral); vertical-align: middle; letter-spacing: -0.01em;
}
.chip .icon { width: 13px; height: 13px; vertical-align: 0; }
.chip-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip-success { background: var(--success-bg); color: var(--success); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-accent { background: var(--accent-soft); color: var(--accent-text); }
.chip-line { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted); }
.chip-lg { height: 28px; padding: 0 12px; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ───────── 카드·구역 ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); min-width: 0; }
.card-body { padding: var(--s5); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: 18px var(--s5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head.plain { border-bottom: 0; padding-bottom: 0; }
.card-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title .icon { color: var(--accent); }
.card-desc { font-size: 14px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.card-foot { padding: 14px var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); display: flex; gap: var(--s3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.card-link { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.sub-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 var(--s3); display: flex; align-items: center; gap: 8px; }
.section-gap { margin-top: var(--s5); }
@media (max-width: 767px) {
    .card-body { padding: var(--s4); }
    .card-head { padding: 14px var(--s4); }
    .card-foot { padding: 12px var(--s4); }
}

/* ───────── 화면 머리 ───────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-desc { margin-top: 6px; color: var(--muted); font-size: 15px; max-width: 760px; }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.back-link:hover { color: var(--text); text-decoration: none; }
@media (max-width: 767px) {
    .page-title { font-size: 22px; }
    .page-head { margin-bottom: var(--s4); }
    .page-desc { font-size: 14.5px; }
}

/* ───────── 알림 (화면 안 안내 상자) ───────── */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); border: 1px solid; font-size: 14.5px; line-height: 1.55; }
.alert > .icon { width: 20px; height: 20px; margin-top: 1px; vertical-align: 0; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.alert-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: 10px; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); } .alert-warn > .icon { color: var(--warn); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-ink); } .alert-danger > .icon { color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-ink); } .alert-info > .icon { color: var(--info); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-ink); } .alert-success > .icon { color: var(--success); }
.alert-neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); } .alert-neutral > .icon { color: var(--muted); }
.alerts { display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s5); }
.alert .btn-sm { height: 30px; }

/* ───────── 토스트 (저장 결과 알림) ───────── */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 14px 10px 14px 16px;
    background: #16201d; color: #f3f6f5; border-radius: var(--r); box-shadow: var(--shadow-lg);
    font-size: 14.5px; line-height: 1.5; animation: hq-toast-in .24s ease;
}
.toast > .icon { color: #7ddcb8; width: 20px; height: 20px; margin-top: 1px; vertical-align: 0; }
.toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-x { border: 0; background: transparent; color: #aab7b2; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; margin-top: -3px; flex-shrink: 0; }
.toast-x:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.toast-x .icon { width: 16px; height: 16px; }
.toast.is-hiding { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes hq-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 1023px) { .toasts { top: calc(var(--topbar-h) + 10px); left: 16px; right: 16px; width: auto; } }

/* ───────── 표 ───────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfc; }
.table tr.is-danger td { background: #fffafa; }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: var(--s5); }
.table th:last-child, .table td:last-child { padding-right: var(--s5); }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--r); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--r); }
.num, .table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cell-actions { text-align: right; white-space: nowrap; }
.kv-table th { background: transparent; width: 132px; color: var(--muted); font-weight: 600; font-size: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: top; }
.kv-table td { padding: 10px 0 10px 12px; }
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: 0; }
@media (max-width: 767px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tfoot, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 14px var(--s4); border-bottom: 1px solid var(--border); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack td, .table-stack td:first-child, .table-stack td:last-child { padding: 3px 0; border: 0; display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); text-align: right; }
    .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; flex-shrink: 0; }
    .table-stack td:not([data-label])::before { content: none; }
    .table-stack td.cell-main { display: block; text-align: left; padding-bottom: 6px; }
    .table-stack td.cell-actions { justify-content: flex-start; padding-top: 10px; }
    .table-stack td.cell-actions .btn { flex: 1; }
    .table-stack tbody tr:hover td { background: transparent; }
    .table-stack tfoot tr { background: var(--surface-2); }
}

/* ───────── 빈 화면 ───────── */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); font-size: 14.5px; }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 14px; color: var(--faint); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-title { font-weight: 700; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty-actions { margin-top: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empty-sm { padding: 24px 16px; }

/* ───────── 탭 (상태 거르기·담기 방법) ───────── */
.tabs { display: flex; gap: 4px; padding: 4px; background: #eceef1; border-radius: 11px; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; color: var(--text-2); font-size: 14.5px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.tab:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .55); }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab .icon { width: 17px; height: 17px; color: var(--muted); }
.tab[aria-current="page"] .icon { color: var(--accent); }
.tab-count { font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab[aria-current="page"] .tab-count { color: var(--accent-text); }

.toolbar { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: var(--s4); }
.toolbar form { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 260px; min-width: 0; }
.search-box > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; vertical-align: 0; }
.search-box > input { padding-left: 40px; }
@media (max-width: 767px) {
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar > form, .toolbar > nav { flex: 0 0 auto !important; width: 100%; }
    .toolbar form { width: 100%; }
    .toolbar form > * { flex: 1 1 auto; }
    .toolbar form > .btn { flex: 0 0 auto; }
    .toolbar select { flex: 1 1 140px; width: auto; }
}

/* ───────── 숫자 요약 ───────── */
.stat { padding: 20px var(--s5); display: flex; flex-direction: column; gap: 2px; color: inherit; }
a.stat:hover { text-decoration: none; background: var(--surface-2); }
.stat-label { font-size: 13.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.25; }
.stat-value small { font-size: 15px; font-weight: 700; margin-left: 2px; }
.stat-sub { font-size: 13px; color: var(--muted); }

/* ───────── 상품 흐름 (소싱 후보 → 등록 대기 → 판매 중) ───────── */
.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.pipe-step { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 20px var(--s5); color: inherit; min-width: 0; }
.pipe-step:hover { background: var(--surface-2); text-decoration: none; }
.pipe-step:first-child { border-radius: var(--r) 0 0 var(--r); }
.pipe-step + .pipe-step { border-left: 1px solid var(--border); }
.pipe-step:not(:first-child):not(.pipe-extra)::before {
    content: ""; position: absolute; left: -13px; top: 50%; width: 24px; height: 24px; margin-top: -12px; z-index: 1; border-radius: 50%;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / 15px no-repeat;
    border: 1px solid var(--border);
}
.pipe-num { font-size: 13px; font-weight: 700; color: var(--accent-text); }
.pipe-label { font-size: 15.5px; font-weight: 700; color: var(--text); }
.pipe-count { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; color: var(--text); }
.pipe-count small { font-size: 15px; margin-left: 2px; font-weight: 700; }
.pipe-desc { font-size: 13px; color: var(--muted); }
.pipe-extra { justify-content: center; background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; min-width: 120px; }
.pipe-extra .pipe-count { font-size: 22px; color: var(--muted); }
@media (max-width: 767px) {
    .pipeline { grid-template-columns: minmax(0, 1fr); }
    .pipe-step { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; padding: 14px var(--s4); }
    .pipe-step + .pipe-step { border-left: 0; border-top: 1px solid var(--border); }
    .pipe-step:not(:first-child):not(.pipe-extra)::before { left: 22px; top: -12px; margin-top: 0; transform: rotate(90deg); }
    .pipe-count { order: 3; margin: 0 0 0 auto; font-size: 22px; }
    .pipe-desc { order: 4; flex-basis: 100%; }
    .pipe-step:first-child { border-radius: var(--r) var(--r) 0 0; }
    .pipe-extra { border-radius: 0 0 var(--r) var(--r); }
}

/* ───────── 오늘 할 일 ───────── */
.todo { display: flex; gap: 14px; align-items: flex-start; padding: 18px var(--s5); }
.todo + .todo { border-top: 1px solid var(--border); }
.todo-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--neutral-bg); color: var(--neutral); }
.todo-icon .icon { width: 20px; height: 20px; vertical-align: 0; }
.todo-icon.is-warn { background: var(--warn-bg); color: var(--warn); }
.todo-icon.is-danger { background: var(--danger-bg); color: var(--danger); }
.todo-icon.is-info { background: var(--info-bg); color: var(--info); }
.todo-icon.is-success { background: var(--success-bg); color: var(--success); }
.todo-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.todo-main { flex: 1; min-width: 0; }
.todo-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.todo-title { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.todo-desc { font-size: 14px; color: var(--muted); margin-top: 2px; }
.todo-items { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.todo-item-main { flex: 1; min-width: 0; }
.todo-item-title { font-weight: 600; font-size: 14.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.todo-item-sub { font-size: 13px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.todo-more { font-size: 13.5px; color: var(--muted); padding: 2px 4px; }
.allclear { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 14px var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); font-size: 14px; color: var(--muted); }
.allclear span { display: inline-flex; align-items: center; gap: 6px; }
.allclear .icon { color: var(--success); width: 16px; height: 16px; vertical-align: 0; }
@media (max-width: 767px) {
    .todo { padding: 16px var(--s4); gap: 12px; }
    .todo-icon { width: 34px; height: 34px; }
    .todo-item { flex-wrap: wrap; }
    .todo-item > .btn { width: 100%; }
    .allclear { padding: 12px var(--s4); }
}

/* ───────── 상품 목록 ───────── */
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--border); display: block; flex-shrink: 0; }
.thumb-sm { width: 44px; height: 44px; border-radius: 8px; }
.thumb-empty { display: grid; place-items: center; color: var(--faint); }
.plist-head, .prow { display: grid; grid-template-columns: 64px minmax(0, 1fr) 128px 176px 150px; grid-template-areas: "thumb main price flow act"; gap: var(--s4); align-items: center; padding: 14px var(--s5); }
.plist-head { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--r) var(--r) 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.prow + .prow { border-top: 1px solid var(--border); }
.prow:hover { background: #fbfcfc; }
.prow .c-thumb { grid-area: thumb; } .prow .c-main { grid-area: main; min-width: 0; } .prow .c-price { grid-area: price; } .prow .c-flow { grid-area: flow; } .prow .c-act { grid-area: act; }
.plist-head .c-price, .prow .c-price { text-align: right; }
.plist-head .c-act, .prow .c-act { text-align: right; }
.prow-name { font-weight: 700; font-size: 15px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.prow-name:hover { color: var(--accent-text); }
.prow-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.prow-meta .sep { margin: 0 5px; color: var(--border-strong); }
.prow .chips { margin-top: 7px; }
.prow-change { font-size: 13px; color: var(--info-ink); margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.prow-change .icon { color: var(--info); width: 15px; height: 15px; margin-top: 2px; vertical-align: 0; }
.price { font-weight: 800; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 2px; }
.next-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 5px; text-align: right; }
@media (max-width: 1199px) {
    .plist-head, .prow { grid-template-columns: 56px minmax(0, 1fr) 120px 150px; grid-template-areas: "thumb main price act" "thumb flow flow act"; row-gap: 10px; }
    .plist-head { grid-template-areas: "thumb main price act"; }
    .plist-head .c-flow { display: none; }
    .prow .thumb { width: 56px; height: 56px; }
    .prow .c-flow { max-width: 320px; }
}
@media (max-width: 767px) {
    .plist-head { display: none; }
    .prow { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "thumb main main" "price price price" "flow flow flow" "act act act"; padding: 16px var(--s4); row-gap: 12px; column-gap: var(--s3); align-items: start; }
    .prow .c-price { text-align: left; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
    .prow .c-flow { max-width: none; }
    .prow .c-act { text-align: left; }
    .prow .c-act .btn { width: 100%; }
    .next-hint { text-align: left; }
}

/* 진행 표시 (이미지 → 사진 → 등록) */
.flow { display: flex; list-style: none; margin: 0; padding: 0; }
.flow li { flex: 1 1 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.2; }
.flow li::before { content: ""; position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); background-position: center; background-repeat: no-repeat; background-size: 12px; }
.flow li + li::after { content: ""; position: absolute; top: 9px; left: calc(-50% + 13px); right: calc(50% + 13px); height: 2px; border-radius: 2px; background: var(--border); }
.flow li.is-done { color: var(--text); }
.flow li.is-done::before { border-color: var(--success); background-color: var(--success); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.flow li.is-done + li::after { background: var(--success); }
.flow li.is-busy { color: var(--info); }
.flow li.is-busy::before { border-color: var(--info-border); border-top-color: var(--info); animation: hq-spin .9s linear infinite; }
.flow li.is-warn { color: var(--warn); }
.flow li.is-warn::before { border-color: var(--warn); background-color: var(--warn); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M12 6v7'/%3E%3Cpath d='M12 18h.01'/%3E%3C/svg%3E"); }
.flow li.is-error { color: var(--danger); }
.flow li.is-error::before { border-color: var(--danger); background-color: var(--danger); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E"); }

/* ───────── 상품 화면: 단계 + 오른쪽 상태 요약 ───────── */
.pgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "main side"; gap: var(--s5); align-items: start; }
.pmain { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }
.pside { grid-area: side; position: sticky; top: 24px; display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
@media (max-width: 1199px) {
    .pgrid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "main"; }
    .pside { position: static; }
}
.step { scroll-margin-top: 24px; }
@media (max-width: 1023px) { .step { scroll-margin-top: calc(var(--topbar-h) + 16px); } }
.step-head { display: flex; gap: 14px; align-items: flex-start; padding: 20px var(--s5); border-bottom: 1px solid var(--border); }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: 15px; display: grid; place-items: center; flex-shrink: 0; }
.step-num .icon { width: 17px; height: 17px; vertical-align: 0; stroke-width: 3; }
.step-num.is-done { background: var(--success); color: #fff; }
.step-num.is-warn { background: var(--warn); color: #fff; }
.step-num.is-error { background: var(--danger); color: #fff; }
.step-num.is-busy { background: var(--info-bg); color: var(--info); }
.step-head-main { flex: 1; min-width: 0; }
.step-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-desc { font-size: 14px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.step-body { padding: var(--s5); }
.step-body > * + * { margin-top: var(--s5); }
.step-part + .step-part { border-top: 1px dashed var(--border); padding-top: var(--s5); }
@media (max-width: 767px) {
    .step-head { padding: 16px var(--s4); flex-wrap: wrap; gap: 12px; }
    .step-head-main { flex-basis: calc(100% - 46px); }
    .step-actions { width: 100%; }
    .step-body { padding: var(--s4); }
}

.pside-body { display: flex; flex-direction: column; gap: var(--s3); }
@media (min-width: 768px) and (max-width: 1199px) {
    .pside-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3) var(--s5); align-items: start; }
    .pside-body > .steplist { grid-column: 1 / -1; }
}
.summary-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.next-box { border-radius: 10px; background: var(--accent-soft); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.next-box.is-calm { background: var(--surface-2); border: 1px solid var(--border); }
.next-box.is-wait { background: var(--info-bg); }
.next-title { font-size: 13px; font-weight: 700; color: var(--accent-text); }
.next-box.is-calm .next-title { color: var(--muted); }
.next-box.is-wait .next-title { color: var(--info); }
.next-text { font-size: 14px; color: var(--text-2); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 6px 0; line-height: 1.45; }
.checklist .icon { width: 17px; height: 17px; margin-top: 1px; vertical-align: 0; }
.checklist .ok .icon { color: var(--success); }
.checklist .no { color: var(--warn-ink); }
.checklist .no .icon { color: var(--warn); }
.checklist .fix { margin-left: auto; font-size: 13px; font-weight: 600; white-space: nowrap; padding-left: 8px; }
.steplist { display: flex; flex-direction: column; gap: 2px; }
.steplist a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.steplist a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.steplist .n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.steplist .n .icon { width: 13px; height: 13px; stroke-width: 3; vertical-align: 0; }
.steplist .is-done .n { background: var(--success); color: #fff; }
.steplist .is-warn .n { background: var(--warn); color: #fff; }
.steplist .is-error .n { background: var(--danger); color: #fff; }
.steplist .is-busy .n { background: var(--info-bg); color: var(--info); }
.steplist .s { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.steplist .is-warn .s { color: var(--warn); }
.steplist .is-error .s { color: var(--danger); }
@media (max-width: 1199px) {
    .steplist { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; }
    .steplist::-webkit-scrollbar { display: none; }
    .steplist a { flex-shrink: 0; border: 1px solid var(--border); background: var(--surface); }
    .steplist .s { margin-left: 4px; }
}

.source-box { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 14px; }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv dd { margin-bottom: 8px; } }

.calc { border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); padding: 16px; font-size: 14.5px; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.calc-row > span:first-child { color: var(--muted); }
.calc-row.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 16px; }
.calc-row.total > span:first-child { color: var(--text); }
.calc-note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.profit { font-size: 14px; color: var(--muted); line-height: 1.6; }
.profit strong { color: var(--text); font-variant-numeric: tabular-nums; }
.profit:empty { display: none; }

/* 저장 막대 (스크롤해도 아래에 붙어 있음) */
.savebar {
    position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
    padding: 12px 12px 12px 18px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.savebar-hint { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; min-width: 0; }
.savebar-hint .icon { color: var(--faint); }
.savebar.is-dirty { border-color: var(--warn-border); }
.savebar.is-dirty .savebar-hint { color: var(--warn-ink); font-weight: 600; }
.savebar.is-dirty .savebar-hint .icon { color: var(--warn); }
@media (max-width: 767px) {
    .savebar { bottom: 0; margin: 0 calc(var(--s4) * -1); border-radius: 0; border-left: 0; border-right: 0; padding: 10px var(--s4); }
    .savebar-hint { font-size: 13px; }
}

/* 사진 칸 */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: var(--s4); }
.tile { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.tile.is-approved { border-color: var(--success-border); box-shadow: 0 0 0 1px var(--success-border); }
.tile-img { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--surface-3); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 4px; flex-wrap: wrap; pointer-events: none; }
.tile-badges .chip { box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.tile-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tile-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tile .check { font-size: 14px; font-weight: 600; align-items: center; }
.tile-sort { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.tile-sort input { width: 56px; }
.tile-actions { display: flex; gap: 6px; }
.tile-actions .btn { flex: 1; }
.tile-actions form { display: contents; }
.tile-form.is-dirty .tile-save { --btn-bg: var(--accent); --btn-fg: #fff; --btn-border: var(--accent); }
.tile-sent { margin-left: auto; }
@media (max-width: 480px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile-sent-text, .tile-sort-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .tile-sent { padding: 0 6px; }
    .tile-sort input { width: 46px; }
    .tile-body { padding: 8px; }
}

.gen-box { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); padding: var(--s4); display: flex; flex-direction: column; gap: 14px; }
.gen-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 이름 근거 패널 */
.reason-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.reason-panel > summary { list-style: none; cursor: pointer; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.reason-panel > summary::-webkit-details-marker { display: none; }
.reason-panel > summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.reason-panel[open] > summary .chev { transform: rotate(180deg); }
.reason-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* 접었다 펴는 상자 */
.disclosure { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 700; font-size: 15px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r); }
.disclosure > summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.disclosure[open] > summary .chev { transform: rotate(180deg); }
.disclosure > summary .summary-sub { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.disclosure-body { padding: 4px 18px 18px; }
.disclosure.flat { border-style: dashed; background: transparent; }
@media (max-width: 767px) { .disclosure > summary { padding: 12px 14px; flex-wrap: wrap; } .disclosure-body { padding: 4px 14px 14px; } }

/* ───────── 담기 화면 ───────── */
.flow-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent-text); font-size: 14.5px; line-height: 1.55; }
.flow-note > .icon { color: var(--accent); width: 20px; height: 20px; margin-top: 1px; vertical-align: 0; }
.flow-note strong { color: var(--accent-text); }
.flow-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; font-size: 13px; font-weight: 600; }
.flow-chain span { background: rgba(255, 255, 255, .75); border-radius: var(--r-full); padding: 3px 10px; color: var(--accent-text); }
.flow-chain span.off { color: var(--faint); text-decoration: line-through; background: rgba(255, 255, 255, .4); }
.flow-chain .icon { width: 14px; height: 14px; color: var(--accent); opacity: .6; vertical-align: 0; }

.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2); padding: 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; transition: background-color .15s, border-color .15s; }
.dropzone.is-over { background: var(--accent-soft); border-color: var(--accent); }
.dropzone-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); flex-shrink: 0; overflow: hidden; }
.dropzone-icon img { width: 100%; height: 100%; object-fit: cover; }
.dropzone-main { flex: 1 1 260px; min-width: 0; }
.dropzone-title { font-weight: 700; font-size: 15.5px; }
.dropzone-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 100%; }
.dropzone-actions input[type=text] { flex: 1 1 220px; width: auto; }
.kbd { display: inline-block; font-family: var(--mono); font-size: 12.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text); }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; font-weight: 600; margin: var(--s4) 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: var(--s4); }
.rcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.rcard:hover { border-color: #b4bac3; box-shadow: var(--shadow); }
.rcard:has(.pick:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.rcard:has(.pick:focus-visible) { box-shadow: 0 0 0 2px var(--accent), var(--focus-ring); }
.rcard.is-existing { cursor: default; }
.rcard.is-existing .rcard-img img { opacity: .55; }
.rcard-pick { position: absolute; top: 10px; left: 10px; z-index: 2; width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .95); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); display: grid; place-items: center; }
.rcard-pick input { width: 18px; height: 18px; }
.rcard-flag { position: absolute; top: 12px; right: 10px; z-index: 2; }
.rcard-img { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--surface-3); }
.rcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcard-body { padding: 12px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; flex: 1; }
.rcard-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.rcard-price strong { font-size: 16.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rcard-price s { color: var(--faint); font-size: 12.5px; }
.rcard-title { line-height: 1.45; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 4px 8px; flex-wrap: wrap; }
.rcard-foot { margin-top: auto; padding-top: 6px; display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; align-items: center; }
@media (max-width: 767px) { .rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .rcard-body { padding: 10px; } }

.actionbar { position: sticky; bottom: 16px; z-index: 20; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px 12px 18px; margin-top: var(--s4); background: rgba(255, 255, 255, .97); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); }
.actionbar-info { font-size: 14px; color: var(--muted); }
.actionbar .spacer { flex: 1; }
@media (max-width: 767px) {
    .actionbar { bottom: 0; margin-left: calc(var(--s4) * -1); margin-right: calc(var(--s4) * -1); border-radius: 0; border-left: 0; border-right: 0; padding: 10px var(--s4); }
    .actionbar > .btn-primary { width: 100%; order: -1; }
}

.prev-row-title { font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview-list .pv { display: grid; grid-template-columns: 28px 64px minmax(0, 1fr) 140px 150px 170px; gap: var(--s4); align-items: start; padding: 16px var(--s5); }
.preview-list .pv + .pv { border-top: 1px solid var(--border); }
.preview-list .pv:has(.pick:checked) { background: #f6fbf9; }
.preview-list .pv-head { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted); align-items: center; border-radius: var(--r) var(--r) 0 0; }
.preview-list .pv-head + .pv { border-top: 0; }
.preview-list .pv > * { min-width: 0; }
.preview-list .pv .pick, .preview-list .pv-head input { margin-top: 2px; }
.pv-label { display: none; }
@media (max-width: 1099px) {
    .preview-list .pv { grid-template-columns: 28px 64px minmax(0, 1fr) 150px; }
    .preview-list .pv > .pv-opt, .preview-list .pv > .pv-store { grid-column: 3 / -1; }
    .preview-list .pv-head > .pv-opt, .preview-list .pv-head > .pv-store { display: none; }
}
@media (max-width: 767px) {
    .preview-list .pv { grid-template-columns: 24px 56px minmax(0, 1fr); padding: 14px var(--s4); gap: 10px 12px; }
    .preview-list .pv > .pv-price, .preview-list .pv > .pv-opt, .preview-list .pv > .pv-store { grid-column: 2 / -1; }
    .preview-list .pv-head { display: none; }
    .pv-label { display: inline; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-right: 6px; }
}

/* ───────── 설정 ───────── */
.anchor-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s5); }
.anchor-nav a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 14px; font-weight: 600; }
.anchor-nav a:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.anchor-nav .icon { width: 16px; height: 16px; color: var(--accent); }
.setting { display: flex; gap: 16px; align-items: flex-start; padding: 18px 0; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting:first-child { padding-top: 0; }
.setting-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.setting-main { flex: 1; min-width: 0; }
.setting-title { font-size: 15.5px; font-weight: 700; color: var(--text); line-height: 1.45; cursor: pointer; display: block; }
.setting-desc { font-size: 14px; color: var(--muted); margin-top: 3px; line-height: 1.55; }
.setting-switch { padding-top: 1px; }
.setting-sub { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.setting-sub-row { display: flex; gap: 12px; align-items: flex-start; }
.setting-sub-row .setting-title { font-size: 14.5px; font-weight: 600; }
.setting-sub-row .setting-desc { font-size: 13.5px; }
.setting.is-off .setting-sub { opacity: .55; }
.setting-inline { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 14.5px; }
.setting-inline label { display: inline-flex; align-items: center; gap: 8px; }
.formula { font-size: 14px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; line-height: 1.7; }
.formula b { color: var(--text); }
.example { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 14.5px; }
.example strong { font-variant-numeric: tabular-nums; }
.example .icon { color: var(--accent); }
.example .lbl { font-weight: 700; margin-right: 4px; }
.steps-ol { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.steps-ol > li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps-ol > li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.steps-ol > li.is-done::before { content: "✓"; background: var(--success); color: #fff; }
.steps-ol > li > div { flex: 1; min-width: 0; }
.copy-field { display: flex; gap: 8px; align-items: stretch; }
.copy-field code { flex: 1; min-width: 0; display: flex; align-items: center; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--border); font-size: 13.5px; word-break: break-all; color: var(--text); }
@media (max-width: 480px) { .copy-field { flex-direction: column; } }

/* ───────── 로그인 ───────── */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1200px 500px at 50% -10%, #e3f0eb 0%, rgba(246, 247, 249, 0) 70%), var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 32px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
@media (max-width: 480px) { .login-card { padding: 24px 20px; } }

/* ───────── 쪽 나누기 ───────── */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pagination a:hover { background: var(--surface-3); text-decoration: none; }
.pagination .on { background: var(--accent); color: #fff; }
.pagination .off { color: var(--border-strong); }

/* ───────── 작은 도구 ───────── */
.stack { display: flex; flex-direction: column; gap: var(--s5); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s3); }
.stack-xs { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s5); align-items: start; }
@media (max-width: 1099px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }
.xs { font-size: 12.5px; }
.strong { font-weight: 700; color: var(--text); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-warn { color: var(--warn); } .text-danger { color: var(--danger); } .text-success { color: var(--success); }
.tnum { font-variant-numeric: tabular-nums; }
.ext { display: inline-flex; align-items: center; gap: 3px; }
.ext .icon { width: 14px; height: 14px; vertical-align: 0; }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--s5) 0; }
.mt-1 { margin-top: var(--s1); } .mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); } .mt-4 { margin-top: var(--s4); } .mt-5 { margin-top: var(--s5); }
.mb-0 { margin-bottom: 0 !important; }
.inline-form { display: inline; }

.nav-count.is-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
main:focus { outline: none; }
.page-title-product { font-size: 22px; line-height: 1.38; letter-spacing: -0.025em; }
.choice-text { display: block; font-size: 14.5px; line-height: 1.5; color: var(--text); }
.choice a.choice-desc { color: var(--accent-text); font-weight: 600; margin-top: 6px; }
.kv.kv-2 { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); column-gap: 18px; }
.show-sm, .show-sm-inline { display: none; }
@media (max-width: 1023px) { .hide-mobile { display: none !important; } }
@media (max-width: 767px) {
    .table-stack .show-sm { display: block; }
    .table-stack .show-sm-inline { display: inline-flex; }
    .table-stack td.cell-block { display: block; text-align: left; padding-top: 4px; }
    .table-stack td.cell-block::before { content: none; }
    .table-stack td > div:only-child { text-align: right; }
}
@media (max-width: 767px) {
    .kv.kv-2 { grid-template-columns: max-content minmax(0, 1fr); }
    .table-stack .hide-sm { display: none !important; }
    .page-title-product { font-size: 19px; }
}
@media (max-width: 480px) { .kv.kv-2 { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ───────── 설정 카드 · 창(모달) ───────── */
.set-group { color: var(--muted); font-size: 13.5px; letter-spacing: 0; margin-bottom: 10px; }
.set-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.set-tile {
    display: flex; align-items: flex-start; gap: 14px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
    padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.set-tile:hover { border-color: var(--accent-soft-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.set-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.set-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.set-ico .icon { width: 20px; height: 20px; }
.set-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.set-title { font-weight: 700; font-size: 15px; color: var(--text); }
.set-desc { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.set-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.set-chev { color: var(--faint); margin-top: 10px; flex-shrink: 0; }
.set-tile:hover .set-chev { color: var(--accent); }

html.modal-open { overflow: hidden; }
dialog.modal {
    padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text);
    width: min(640px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px);
    box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal.modal-lg { width: min(860px, calc(100vw - 32px)); }
dialog.modal.modal-sm { width: min(460px, calc(100vw - 32px)); }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .18s ease-out; }
dialog.modal::backdrop { background: rgba(17, 24, 39, .45); backdrop-filter: blur(2px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { position: relative; padding-right: 60px; flex-shrink: 0; }
.modal-x { position: absolute; top: 10px; right: 10px; }
.modal-body { overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.modal-foot { border-radius: 0; flex-shrink: 0; }
@media (max-width: 767px) {
    .set-grid { grid-template-columns: minmax(0, 1fr); }
    dialog.modal, dialog.modal.modal-lg, dialog.modal.modal-sm { width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
    .modal-body { padding: var(--s4); }
    .modal-head, .modal-foot { padding-left: var(--s4); }
}
