:root {
    --primary: #D4062D;
    --primary-dark: #b80527;
    --bg: #f7f8fa;
    --text: #222;
    --muted: #777;
    --line: #e6e8ec;
    --card: #fff;
    --radius: 18px;
    --control-height: 48px;

    --focus-shadow: 0 0 0 4px rgba(212, 6, 45, 0.1);
    --card-shadow: 0 12px 34px rgba(20, 24, 31, 0.05);

    --disabled-bg: #f3f4f6;
    --disabled-border: #d1d5db;
    --disabled-text: #9ca3af;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-text-size-adjust: none;
}

button, input, textarea {
    font-family: inherit;
}

.container {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 56px 20px 80px;
}

.header {
    margin-bottom: 36px;
    text-align: left;
}

#apply-form, #step3-group {
    display: grid;
    gap: 24px;
    width: 100%;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--card-shadow);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field.full {
    grid-column: 1 / -1;
}

/* Flex 정렬 */
.section-title, .phone-row, .calendar-header, .time-slot, .badge {
    display: flex;
    align-items: center;
}

.section-title {
    gap: 12px;
    margin-bottom: 28px;
}

h1 {
    margin: 0 0 12px;
    font-size: 34px;
    letter-spacing: -0.04em;
    font-weight: 800;
}

h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -0.03em;
    color: #111;
}

.badge {
    display: inline-flex;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(212, 6, 45, 0.08);
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 18px;
}

.description, .optional {
    color: var(--muted);
}

.description {
    font-size: 16px;
}

.optional {
    font-size: 14px;
    font-weight: 500;
    margin-left: 6px;
}

.sub-desc {
    display: block;
    font-size: 13px;
    color: var(--muted);
    font-weight: 400;
    margin-top: 4px;
    line-height: 1.5;
}

.field-label {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.required {
    color: var(--primary);
    margin-left: 4px;
}

.step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
}

/* form 요소 */
input[type="text"], input[type="tel"], input[type="email"], textarea, .custom-select-trigger {
    width: 100%;
    max-width: 100%;
    min-height: var(--control-height);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 16px;
    font-size: 15px;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* focus */
input:focus, textarea:focus, .custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: var(--focus-shadow);
}

textarea {
    height: auto;
    min-height: 100px;
    padding: 14px 16px;
    resize: vertical;
}

.textarea-wrap {
    position: relative;
    width: 100%;
}

.char-counter {
    position: absolute;
    right: 16px;
    bottom: 12px;
    font-size: 12px;
    color: var(--muted);
}

/* 셀렉트박스 */
.native-select-hidden {
    display: none !important;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    padding-right: 42px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    line-height: 1;
    text-align: left;
}

.custom-select-trigger::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.2s ease;
}

.custom-select.open .custom-select-trigger::after {
    transform: translateY(-35%) rotate(225deg);
}

.custom-select-list {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 240px;
    overflow-y: auto;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 14px 30px rgba(20, 24, 31, 0.12);
}

.custom-select.open .custom-select-list {
    display: block;
}

.custom-select-list li {
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.custom-select-list li:hover {
    background: rgba(212, 6, 45, 0.06);
}

.custom-select-list li.active {
    font-weight: 700;
}

.custom-select-list li.disabled {
    color: var(--disabled-text);
    cursor: not-allowed;
    background: var(--disabled-bg);
}

/* 전화번호 */
.phone-row {
    gap: 8px;
    width: 100%;
}

.phone-row .custom-select {
    width: 15%;
    min-width: 76px;
    flex-shrink: 0;
}

.phone-row .input-phone-part {
    flex: 1;
    min-width: 0;
}

.phone-dash {
    color: #ccc;
    flex-shrink: 0;
}

.btn-auth {
    flex: 0 0 120px;
    width: 120px;
    height: var(--control-height);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 12px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.btn-auth:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #bbb;
}

/* 달력, 시간 */
.schedule-box {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(220px, 340px);
    gap: 24px;
    margin-top: 12px;
    align-items: stretch;
}

.custom-calendar-container {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    background: #fff;
}

.calendar-header {
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 16px;
}

.calendar-header button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}

.calendar-weekdays, .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.calendar-weekdays {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 12px;
}

.calendar-days {
    gap: 6px;
}

.calendar-day-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 40px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 50%;
    font-size: 15px;
    user-select: none;
}

.calendar-day-item.selected {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.calendar-day-item.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.time-slot-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 10px;
    height: 100%;
}

.time-slot {
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 2px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.time-slot:hover {
    border-color: var(--primary);
    background: rgba(212, 6, 45, 0.02);
}

.time-slot.active {
    border-color: var(--primary);
    font-weight: 700;
}

.time-slot.disabled {
    background: var(--disabled-bg);
    border-color: var(--disabled-border);
    color: var(--disabled-text);
    cursor: not-allowed;
    pointer-events: none;
}

/* 설문 */
.choice-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.choice-group.single-col {
    grid-template-columns: 1fr;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.choice:hover {
    background: #fbfbfc;
    border-color: #d1d5db;
}

.choice input {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.choice span {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    word-break: keep-all;
}

.choice.has-text {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.choice-input-text {
    width: 100%;
    min-width: 100%;
    padding: 10px 12px !important;
    font-size: 14px !important;
}

/* 안내사항 */
.notification {
    background: #f0f2f5;
    border-radius: 14px;
    padding: 24px;
    margin-top: 8px;
}

.notification-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.notification-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notification-list li {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    padding-left: 12px;
    text-indent: -12px;
    word-break: keep-all;
}

.btn-wrap {
    margin-top: 12px;
}

.btn-submit {
    width: 100%;
    border: 1px solid var(--primary);
    border-radius: 14px;
    padding: 16px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 24px rgba(212, 6, 45, 0.2);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* 비활성화 */
.btn-auth:disabled, .btn-submit:disabled {
    background: var(--disabled-bg);
    border-color: var(--disabled-border);
    color: var(--disabled-text);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .container {
        padding: 32px 14px 60px;
    }

    .phone-row {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .phone-row .custom-select {
        width: 25% !important;
        flex: none;
    }

    .phone-row .input-phone-part {
        flex: 1;
        width: auto;
    }

    .phone-dash {
        display: block;
        color: #ccc;
    }

    .phone-row #authcode {
        width: 100%;
        flex: none;
    }

    .btn-auth {
        flex: 0 0 100%;
        width: 100%;
        height: var(--control-height);
        margin-top: 4px;
    }

    h1, .header {
        text-align: center;
    }

    h1 {
        font-size: 26px;
    }

    .section {
        padding: 20px 16px;
    }

    .grid, .choice-group, .schedule-box {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .time-slot-container {
        min-height: 290px;
        margin-top: 8px;
    }

    .choice.has-text {
        align-items: stretch;
        width: 100%;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 22px;
    }

    .calendar-day-item {
        font-size: 13px;
    }
}