/*
 * AI 작업대 (/ai-service/workbench) 전용 스타일  — 2026-08-22
 *
 * ⛔ 전역 요소 선택자를 만들지 않는다. 모든 규칙은 .cgw 아래에서만 산다.
 *    (같은 사이트의 AI 모델 소개 6페이지가 공용 CSS 를 쓰고 있어 전역 규칙은 곧 회귀다.)
 * 🔴 한글은 word-break:keep-all / overflow-wrap:normal 을 유지한다.
 * 🔴 입력·버튼 최소 높이 44px. 동작은 폼 전환·가격 재계산·제작 진행에만 쓴다.
 */

.cgw {
    --cgw-bg: #F6F7F4;
    --cgw-ink: #171918;
    --cgw-muted: #5C635E;
    --cgw-line: #D4DAD5;
    --cgw-green: #0B7A5A;
    --cgw-mint: #DCEFE7;
    --cgw-orange: #E84719;
    --cgw-card: #FFFFFF;

    background: var(--cgw-bg);
    color: var(--cgw-ink);
    font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    line-height: 1.65;
    word-break: keep-all;
    overflow-wrap: normal;
}

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

.cgw-shell { width: min(1180px, 100% - 40px); margin-inline: auto; }

/* ── 히어로 ─────────────────────────────── */
.cgw-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--cgw-line); }
.cgw-eyebrow { margin: 0 0 12px; font-size: .78rem; letter-spacing: .16em; color: var(--cgw-green); font-weight: 700; }
.cgw-hero h1 { margin: 0 0 16px; font-size: clamp(1.6rem, 3.4vw, 2.5rem); line-height: 1.35; font-weight: 700; }
.cgw-lead { margin: 0; max-width: 62ch; color: var(--cgw-muted); }

.cgw-notice {
    margin-top: 24px; padding: 16px 18px; border: 1px solid var(--cgw-line);
    border-left: 4px solid var(--cgw-orange); background: var(--cgw-card); border-radius: 6px;
}
.cgw-notice strong { display: block; margin-bottom: 4px; }

/* ── 작업대 3단 ─────────────────────────── */
.cgw-board {
    display: grid; gap: 28px; padding: 40px 0 64px;
    grid-template-columns: 190px minmax(0, 1fr) 320px;
    align-items: start;
}

.cgw-rail { position: sticky; top: 88px; }
.cgw-rail ol { margin: 0; padding: 0; list-style: none; }
.cgw-rail li {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 0; font-size: .9rem; color: var(--cgw-muted);
}
.cgw-rail li span {
    flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--cgw-line);
    color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center;
}
.cgw-rail li.is-current { color: var(--cgw-ink); font-weight: 600; }
.cgw-rail li.is-current span { background: var(--cgw-green); }

/* ── 폼 ─────────────────────────────────── */
.cgw-form { display: grid; gap: 20px; min-width: 0; }

.cgw-block {
    margin: 0; padding: 22px; border: 1px solid var(--cgw-line);
    background: var(--cgw-card); border-radius: 8px;
}
.cgw-block legend { padding: 0 6px; font-weight: 700; font-size: 1.02rem; }
.cgw-optional { color: var(--cgw-muted); font-weight: 400; font-size: .85rem; }

.cgw-tasks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cgw-task { display: block; cursor: pointer; }
.cgw-task input { position: absolute; opacity: 0; width: 0; height: 0; }
.cgw-task__body {
    display: block; min-height: 44px; padding: 14px 16px;
    border: 1px solid var(--cgw-line); border-radius: 6px; background: #fff;
}
.cgw-task input:checked + .cgw-task__body { border-color: var(--cgw-green); background: var(--cgw-mint); }
.cgw-task input:focus-visible + .cgw-task__body { outline: 2px solid var(--cgw-green); outline-offset: 2px; }
.cgw-task__label { display: block; font-weight: 600; }
.cgw-task__lead { display: block; margin-top: 2px; font-size: .85rem; color: var(--cgw-muted); }

.cgw-field { display: block; margin-top: 16px; }
.cgw-field > span { display: block; margin-bottom: 6px; font-size: .88rem; font-weight: 600; }
.cgw-field select,
.cgw-field input,
.cgw-field textarea {
    width: 100%; min-height: 44px; padding: 10px 12px;
    border: 1px solid var(--cgw-line); border-radius: 6px; background: #fff;
    font: inherit; color: inherit;
}
.cgw-field textarea { min-height: 96px; resize: vertical; }
.cgw-field select:focus-visible,
.cgw-field input:focus-visible,
.cgw-field textarea:focus-visible { outline: 2px solid var(--cgw-green); outline-offset: 1px; }
.cgw-field small { display: block; margin-top: 4px; font-size: .8rem; color: var(--cgw-muted); }

/* ── 첨부 ───────────────────────────────── */
.cgw-warn {
    margin: 0 0 14px; padding: 10px 12px; font-size: .85rem;
    background: #FFF3EF; border: 1px solid #F6C9BB; border-radius: 6px; color: #8A2B12;
}
.cgw-drop {
    display: grid; place-items: center; min-height: 96px; padding: 18px;
    border: 1px dashed var(--cgw-line); border-radius: 8px; text-align: center;
    color: var(--cgw-muted); cursor: pointer; background: #FCFDFC;
}
.cgw-drop.is-over { border-color: var(--cgw-green); background: var(--cgw-mint); }
.cgw-files { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cgw-files li {
    display: flex; gap: 10px; align-items: center; justify-content: space-between;
    padding: 10px 12px; border: 1px solid var(--cgw-line); border-radius: 6px; font-size: .88rem;
}
.cgw-files button {
    min-height: 32px; padding: 4px 10px; border: 1px solid var(--cgw-line);
    background: #fff; border-radius: 4px; cursor: pointer; font: inherit;
}

/* ── 크기·형식 ──────────────────────────── */
.cgw-sizes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.cgw-size {
    display: grid; gap: 2px; padding: 14px 16px; min-height: 44px;
    border: 1px solid var(--cgw-line); border-radius: 6px; cursor: pointer; background: #fff;
}
.cgw-size:has(input:checked) { border-color: var(--cgw-green); background: var(--cgw-mint); }
.cgw-size:has(input:focus-visible) { outline: 2px solid var(--cgw-green); outline-offset: 2px; }
.cgw-size input { position: absolute; opacity: 0; width: 0; height: 0; }
.cgw-size__label { font-weight: 600; }
.cgw-size__hint { font-size: .82rem; color: var(--cgw-muted); }
.cgw-size__price { font-weight: 700; color: var(--cgw-green); }

/* 종류 칩 — 고르면 아래 질문이 통째로 바뀐다. */
.cgw-sublabel { margin: 18px 0 8px; font-size: .88rem; font-weight: 600; }
.cgw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cgw-chip {
    display: inline-flex; align-items: center; min-height: 44px;
    padding: 8px 14px; border: 1px solid var(--cgw-line); border-radius: 999px;
    cursor: pointer; background: #fff; font-size: .9rem;
}
.cgw-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.cgw-chip:has(input:checked) { border-color: var(--cgw-green); background: var(--cgw-mint); font-weight: 600; }
.cgw-chip:has(input:focus-visible) { outline: 2px solid var(--cgw-green); outline-offset: 2px; }

.cgw-formats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cgw-formats label {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
    padding: 8px 14px; border: 1px solid var(--cgw-line); border-radius: 999px; cursor: pointer;
}
.cgw-formats label:has(input:checked) { border-color: var(--cgw-green); background: var(--cgw-mint); }

/* ── 동의 ───────────────────────────────── */
.cgw-terms { margin: 0 0 16px; padding-left: 18px; color: var(--cgw-muted); font-size: .88rem; }
.cgw-terms li { margin-bottom: 6px; }
.cgw-check { display: flex; gap: 8px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; }
.cgw-check input { margin-top: 4px; width: 18px; height: 18px; }

/* ── 주문 요약 ──────────────────────────── */
.cgw-summary { position: sticky; top: 88px; }
.cgw-summary__inner {
    padding: 20px; border: 1px solid var(--cgw-line); border-radius: 8px; background: var(--cgw-card);
}
.cgw-summary h2 { margin: 0 0 14px; font-size: 1.05rem; }

/* 내 충전금 — 전표 맨 위. 손님이 가장 먼저 찾는 숫자다. */
.cgw-mycredit {
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
    margin: -4px 0 16px; padding: 12px 14px;
    background: var(--cgw-mint); border-radius: 8px;
}
.cgw-mycredit > span { font-size: .85rem; color: #0B5C45; }
.cgw-mycredit > strong { font-size: 1.25rem; color: var(--cgw-green); margin-inline-start: auto; }
.cgw-mycredit > a { font-size: .82rem; color: #0B5C45; text-decoration: underline; }

.cgw-ticket, .cgw-price { margin: 0; display: grid; gap: 8px; font-size: .9rem; }
.cgw-ticket > div, .cgw-price > div { display: flex; gap: 12px; justify-content: space-between; }
.cgw-ticket dt, .cgw-price dt { margin: 0; color: var(--cgw-muted); }
.cgw-ticket dd, .cgw-price dd { margin: 0; text-align: right; font-weight: 600; }
.cgw-price { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--cgw-line); }
.cgw-price .is-total dd { color: var(--cgw-green); font-size: 1.15rem; }

.cgw-cta {
    width: 100%; min-height: 52px; margin-top: 18px; padding: 14px 18px;
    border: 0; border-radius: 8px; background: var(--cgw-green); color: #fff;
    font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
}
.cgw-cta[disabled] { background: #A9B3AD; cursor: not-allowed; }
.cgw-cta:focus-visible { outline: 3px solid var(--cgw-orange); outline-offset: 2px; }

.cgw-sub {
    display: block; margin-top: 10px; min-height: 44px; padding: 10px 0;
    text-align: center; color: var(--cgw-green); font-size: .9rem; text-decoration: underline;
}

.cgw-error { margin: 12px 0 0; color: #B3300F; font-size: .88rem; }
.cgw-progress { margin-top: 14px; padding: 12px; border-radius: 6px; background: var(--cgw-mint); font-size: .9rem; }

/* ── 결과 이후 ──────────────────────────── */
.cgw-after { padding: 48px 0 72px; border-top: 1px solid var(--cgw-line); }
.cgw-after h2 { margin: 0 0 20px; font-size: 1.3rem; }
.cgw-after__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cgw-after__grid article { padding: 20px; border: 1px solid var(--cgw-line); border-radius: 8px; background: var(--cgw-card); }
.cgw-after__grid h3 { margin: 0 0 8px; font-size: 1.02rem; }
.cgw-after__grid p { margin: 0 0 12px; color: var(--cgw-muted); font-size: .9rem; }
.cgw-after__grid a { display: inline-block; min-height: 44px; padding: 11px 0; color: var(--cgw-green); font-weight: 600; }

/* ── 결과 화면 ──────────────────────────── */
.cgw-result { padding: 48px 0 72px; }
.cgw-result h1 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 2rem); }
.cgw-result__meta { margin: 0 0 24px; color: var(--cgw-muted); font-size: .9rem; }
.cgw-result__files { margin: 0 0 24px; padding: 0; list-style: none; display: grid; gap: 10px; }
.cgw-result__files li {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    padding: 14px 16px; border: 1px solid var(--cgw-line); border-radius: 8px; background: var(--cgw-card);
}
.cgw-result__files a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px;
    border-radius: 6px; background: var(--cgw-green); color: #fff; font-weight: 600; text-decoration: none; }
.cgw-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cgw-actions button, .cgw-actions a {
    min-height: 44px; padding: 11px 18px; border-radius: 8px; border: 1px solid var(--cgw-green);
    background: #fff; color: var(--cgw-green); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center;
}
.cgw-preview { width: 100%; height: 520px; margin-top: 24px; border: 1px solid var(--cgw-line); border-radius: 8px; background: #fff; }

.cgw-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cgw-table th, .cgw-table td { padding: 10px 12px; border-bottom: 1px solid var(--cgw-line); text-align: left; }
.cgw-scroll { overflow-x: auto; }

/* ── 반응형 ─────────────────────────────── */
@media (max-width: 1080px) {
    .cgw-board { grid-template-columns: minmax(0, 1fr) 300px; }
    .cgw-rail { display: none; }
}

@media (max-width: 820px) {
    .cgw-shell { width: min(1180px, 100% - 32px); }
    .cgw-board { grid-template-columns: minmax(0, 1fr); padding-bottom: 120px; }
    .cgw-summary { position: static; }
    .cgw-summary__inner { position: relative; }

    /* 하단 고정 버튼 — footer 와 본문을 가리지 않도록 본문에 여백을 준다. */
    /* right 여백은 상담 채팅 런처(우하단 ~64px)를 피하려는 것 — 겹치면 결제 버튼 끝이 가린다. */
    .cgw-board .cgw-cta {
        position: fixed; left: 16px; right: 88px; bottom: 16px; width: auto;
        z-index: 40; box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cgw * { transition: none !important; animation: none !important; }
}
