/* ==========================================================================
   NOL 호텔 가격 트래커 — Responsive UI & Mobile-First Detail Modal Stylesheet
   ========================================================================== */

:root {
    --bg-body: #f3f5f9;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-muted: #f1f5f9;

    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-border: #bfdbfe;

    /* 한국 사용자 직관 색상: 가격 인하(파랑/청록), 가격 인상(빨강/코랄), 판매중(초록), 마감(슬레이트/로즈) */
    --down-color: #0284c7;
    --down-bg: #e0f2fe;
    --up-color: #e11d48;
    --up-bg: #ffe4e6;
    --active-color: #059669;
    --active-bg: #d1fae5;
    --warn-color: #d97706;
    --warn-bg: #fef3c7;
    --soldout-color: #be123c;
    --soldout-bg: #ffe4e6;

    --sun-color: #e11d48;
    --sat-color: #2563eb;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
    --shadow-modal: 0 20px 50px rgba(15, 23, 42, 0.24);

    --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
        system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

.hidden {
    display: none !important;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   로그인 화면
   ========================================================================== */
.auth-body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top right, #dbeafe 0%, #f3f5f9 50%, #eef2ff 100%);
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.auth-eyebrow {
    margin: 0 0 2px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
}

.auth-title {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.setup-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 18px;
    font-size: 13px;
}

.setup-notice strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13.5px;
}

.setup-notice p {
    margin: 0 0 8px;
}

.setup-notice code {
    display: block;
    background: #fef3c7;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    word-break: break-all;
    color: #78350f;
}

.alert-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--soldout-bg);
    color: var(--soldout-color);
    border: 1px solid #fecdd3;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
}

.alert-error svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-field input {
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 16px;
    color: var(--text-main);
    background: var(--bg-surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-field input:focus,
.form-select:focus,
.modal-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* ==========================================================================
   공통 버튼 & 뱃지
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-lg {
    height: 46px;
    font-size: 15px;
}

.btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-xs {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary-border);
}

.btn-secondary:hover:not(:disabled) {
    background: #dbeafe;
}

.btn-outline {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--text-main);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--text-main);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--soldout-color);
    border-color: #fecdd3;
}

.btn-danger-ghost:hover:not(:disabled) {
    background: var(--soldout-bg);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--bg-muted);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.inline-form {
    display: inline;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
}

.badge-primary-soft {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ==========================================================================
   상단 헤더 & 메인 레이아웃
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-title {
    margin: 0;
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-sub {
    margin: 1px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.mode-tabs {
    display: inline-flex;
    background: var(--bg-muted);
    padding: 4px;
    border-radius: 11px;
    gap: 4px;
}

.mode-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-tab.is-active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-muted);
    padding: 5px 10px;
    border-radius: 999px;
}

.main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 18px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 상태 안내 배너 */
.status-banner {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #78350f;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13.5px;
}

.status-banner.is-preview {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e3a8a;
}

.status-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   컨트롤 패널 & 월 이동 바
   ========================================================================== */
.control-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-hotel {
    flex: 1 1 280px;
    min-width: 0;
}

.control-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.form-select {
    height: 40px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-size: 14.5px;
    font-weight: 600;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.form-select-compact {
    min-width: 150px;
}

.form-select-xs {
    height: 30px;
    font-size: 12.5px;
    padding: 0 28px 0 10px;
    border-radius: 8px;
    width: auto;
}

.compare-select-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compare-select-actions .form-select {
    flex: 1;
    min-width: 0;
}

.calendar-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--bg-muted);
    flex-wrap: wrap;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.month-display-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.month-title {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.month-title:hover {
    background: var(--bg-muted);
}

.month-picker-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.calendar-legend-and-view {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.legend-items {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 4px;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-change {
    background: #f59e0b;
}

.dot-soldout {
    background: var(--soldout-color);
}

.view-toggle {
    display: inline-flex;
    background: var(--bg-muted);
    padding: 3px;
    border-radius: 9px;
}

.view-btn {
    border: none;
    background: transparent;
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
}

.view-btn.is-active {
    background: var(--bg-surface);
    color: var(--text-main);
    box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   월간 요약 지표 바
   ========================================================================== */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: var(--shadow-xs);
}

.summary-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-card-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.summary-card-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   달력 그리드 (PC & 모바일 초소형 칸 대응)
   ========================================================================== */
.calendar-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 360px;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: nhp-spin 0.7s linear infinite;
}

@keyframes nhp-spin {
    to {
        transform: rotate(360deg);
    }
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.calendar-weekdays > div {
    padding: 10px 4px;
}

.wk-sun {
    color: var(--sun-color);
}

.wk-sat {
    color: var(--sat-color);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-cell {
    min-height: 112px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 9px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--bg-surface);
    position: relative;
    transition: background-color 0.12s ease;
    min-width: 0;
}

.cal-cell:nth-child(7n) {
    border-right: none;
}

.cal-cell.is-outside {
    background: #f8fafc;
    opacity: 0.42;
    pointer-events: none;
}

.cal-cell.is-clickable {
    cursor: pointer;
}

.cal-cell.is-clickable:hover {
    background: #f0f7ff;
}

.cal-cell.is-clickable:active {
    background: #e0effe;
}

.cal-cell.is-today {
    background: #fefce8;
}

.cal-cell.is-today.is-clickable:hover {
    background: #fef9c3;
}

.cal-cell.is-all-soldout {
    background: #fafafa;
}

.cal-cell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    margin-bottom: 4px;
}

.cal-day-num {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cal-day-num.is-sun {
    color: var(--sun-color);
}

.cal-day-num.is-sat {
    color: var(--sat-color);
}

.today-dot {
    font-size: 10px;
    font-weight: 800;
    background: var(--primary);
    color: #fff;
    padding: 1px 5px;
    border-radius: 999px;
}

.cal-change-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
    background: #fef3c7;
    color: #b45309;
    flex-shrink: 0;
}

.cal-change-badge.has-down {
    background: var(--down-bg);
    color: var(--down-color);
}

.cal-change-badge.has-up {
    background: var(--up-bg);
    color: var(--up-color);
}

.cal-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cal-price-main {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-price-compact {
    display: none;
}

.cal-room-hint {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-soldout-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--soldout-bg);
    color: var(--soldout-color);
}

.cal-empty-dash {
    font-size: 12px;
    color: #cbd5e1;
}

.cal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.cal-count-pill {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-count-pill strong {
    color: var(--active-color);
}

/* 비교 모드 달력 셀 미니 리스트 */
.cmp-cell-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.cmp-cell-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 11px;
    line-height: 1.3;
}

.cmp-cell-row.is-lowest {
    font-weight: 800;
    color: var(--primary);
}

.cmp-cell-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.cmp-cell-row.is-lowest .cmp-cell-name {
    color: var(--primary);
}

.cmp-cell-val {
    flex-shrink: 0;
    font-weight: 700;
}

/* ==========================================================================
   일자별 목록형 뷰 (모바일 친화 스크롤 리스트)
   ========================================================================== */
.calendar-list-view {
    display: flex;
    flex-direction: column;
    divide-y: 1px solid var(--border-color);
}

.day-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.12s;
}

.day-list-row:hover {
    background: #f8fbff;
}

.day-list-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.day-list-datebox {
    width: 54px;
    text-align: center;
    padding: 6px 4px;
    border-radius: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.day-list-datebox .dl-num {
    display: block;
    font-size: 16px;
    font-weight: 800;
}

.day-list-datebox .dl-dow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.day-list-meta {
    min-width: 0;
}

.day-list-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.day-list-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.day-list-right {
    text-align: right;
    flex-shrink: 0;
}

.day-list-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
}

.day-list-range {
    font-size: 11.5px;
    color: var(--text-muted);
}

.empty-state {
    padding: 56px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--text-secondary);
}

.empty-state p {
    margin: 0;
    font-size: 13.5px;
}

/* ==========================================================================
   상세정보 모달 (PC 다이얼로그 + 모바일 풀 바텀시트)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 0.16s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-sheet {
    width: min(980px, 100%);
    max-height: 90dvh;
    background: var(--bg-body);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sheet-md {
    width: min(720px, 100%);
    background: var(--bg-surface);
}

@keyframes modal-pop {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: var(--bg-surface);
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.modal-hotel-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.modal-title {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    word-break: keep-all;
}

.modal-desc {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.modal-close-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--bg-muted);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

/* 모달 내부 날짜 스텝 네비게이션 (< 전일 | 날짜 | 익일 >) */
.modal-date-bar {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 7px 10px;
}

.date-step-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}

.date-step-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary-border);
}

.modal-date-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-date-label {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--text-main);
}

.modal-date-label.is-sun {
    color: var(--sun-color);
}

.modal-date-label.is-sat {
    color: var(--sat-color);
}

.modal-checked-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* 모달 필터 툴바 */
.modal-Toolbar {
    background: var(--bg-surface);
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.filter-chips-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-chips-scroll::-webkit-scrollbar {
    display: none;
}

.chip {
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.14s;
}

.chip:hover {
    border-color: var(--border-strong);
    color: var(--text-main);
}

.chip.is-active {
    background: var(--text-main);
    border-color: var(--text-main);
    color: #fff;
}

.chip-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.chip-sm.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.modal-sub-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-usetype-chips {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.modal-right-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* 모달 본문 */
.modal-body {
    padding: 16px 20px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}

.modal-loading {
    padding: 48px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 모달 내부 4칸 요약 KPI */
.modal-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.kpi-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 11px 13px;
}

.kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.kpi-val {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.kpi-val.is-primary {
    color: var(--primary);
}

.kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-search-wrap {
    margin-bottom: 14px;
}

.modal-search-input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-size: 14px;
    color: var(--text-main);
}

/* ==========================================================================
   객실 카드 (Room Type Card) & 요금제 아이템 (Offer Item)
   ========================================================================== */
.modal-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.room-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.room-card.is-all-closed {
    opacity: 0.85;
}

.room-card-header {
    padding: 14px 16px;
    background: linear-gradient(to bottom, #ffffff, #fafbfd);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.room-card.is-collapsed .room-card-header {
    border-bottom: none;
}

.room-card.is-collapsed .room-offers-wrap {
    display: none;
}

.room-head-left {
    min-width: 0;
    flex: 1;
}

.room-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.room-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.room-sub-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.room-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.room-min-price {
    text-align: right;
}

.room-min-price .rm-price {
    display: block;
    font-size: 16.5px;
    font-weight: 800;
    color: var(--primary);
}

.room-min-price .rm-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.room-chevron {
    color: var(--text-light);
    transition: transform 0.18s;
}

.room-card.is-collapsed .room-chevron {
    transform: rotate(-90deg);
}

/* 요금제 아이템 */
.offer-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--bg-muted);
    transition: background 0.12s;
}

.offer-item:last-child {
    border-bottom: none;
}

.offer-item.is-unavailable-row {
    background: #fcfcfd;
}

.offer-main-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.offer-info-col {
    flex: 1;
    min-width: 0;
}

.offer-tags {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--bg-muted);
    color: var(--text-secondary);
}

.tag-stay {
    background: #eef2ff;
    color: #4338ca;
}

.tag-dayuse {
    background: #f0fdf4;
    color: #15803d;
}

.tag-stock-low {
    background: var(--warn-bg);
    color: var(--warn-color);
}

.tag-stale {
    background: #f1f5f9;
    color: #64748b;
    border: 1px dashed #cbd5e1;
}

.tag-invalid {
    background: var(--soldout-bg);
    color: var(--soldout-color);
}

.offer-plan-name {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-main);
    word-break: keep-all;
}

.offer-item.is-unavailable-row .offer-plan-name {
    color: var(--text-secondary);
}

.offer-meta-line {
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}

.policy-toggle-btn {
    border: none;
    background: none;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.policy-box {
    margin-top: 8px;
    padding: 9px 11px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-line;
}

/* 우측 가격 & 변동 뱃지 컬럼 */
.offer-price-col {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.offer-rack-line {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.discount-text {
    font-weight: 800;
    color: var(--up-color);
}

.rack-strike {
    color: var(--text-light);
    text-decoration: line-through;
}

.offer-current-price {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.offer-dual-price {
    font-size: 11.5px;
    color: var(--text-muted);
}

.soldout-pill-lg {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 800;
    background: var(--soldout-bg);
    color: var(--soldout-color);
}

.last-price-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* 직전 대비 / 최초 대비 변동폭 칩 */
.delta-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

.delta-down {
    background: var(--down-bg);
    color: var(--down-color);
}

.delta-up {
    background: var(--up-bg);
    color: var(--up-color);
}

.delta-status {
    background: #fef3c7;
    color: #b45309;
}

/* 히스토리 펼치기 버튼 */
.history-toggle-btn {
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.14s;
}

.history-toggle-btn.has-changes {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary);
}

.history-toggle-btn:hover {
    filter: brightness(0.97);
}

/* ==========================================================================
   시간대별 가격변동 히스토리 패널 (SVG 추이 차트 + 수직 타임라인)
   ========================================================================== */
.history-panel {
    margin-top: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    padding: 13px 14px;
}

.history-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.history-panel-head strong {
    font-size: 12.5px;
    color: var(--text-main);
}

/* SVG 미니 스파크라인 차트 */
.sparkline-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px 8px;
    margin-bottom: 12px;
}

.sparkline-svg {
    width: 100%;
    height: 76px;
    display: block;
    overflow: visible;
}

.sparkline-axis-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 시간대별 수직 타임라인 */
.timeline-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.timeline-item {
    position: relative;
    padding-left: 20px;
    padding-bottom: 11px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 14px;
    bottom: -4px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #94a3b8;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 1px #cbd5e1;
}

.timeline-item.is-down .timeline-dot {
    background: var(--down-color);
    box-shadow: 0 0 0 1px var(--down-color);
}

.timeline-item.is-up .timeline-dot {
    background: var(--up-color);
    box-shadow: 0 0 0 1px var(--up-color);
}

.timeline-item.is-soldout .timeline-dot {
    background: var(--soldout-color);
    box-shadow: 0 0 0 1px var(--soldout-color);
}

.timeline-item.is-reopened .timeline-dot {
    background: var(--active-color);
    box-shadow: 0 0 0 1px var(--active-color);
}

.timeline-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-time {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.timeline-hold {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 4px;
}

.timeline-price-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.timeline-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
}

.timeline-row-sub {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   맞춤 객실 비교 상세 모달 & 비교 그룹 편집기
   ========================================================================== */
.cmp-ranking-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
}

.cmp-rank-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 13px;
    min-width: 170px;
    flex: 1 0 170px;
    cursor: pointer;
    transition: border-color 0.14s;
}

.cmp-rank-chip.is-winner {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.cmp-rank-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmp-rank-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 2px;
}

.cmp-rank-chip.is-winner .cmp-rank-price {
    color: var(--primary);
}

.cmp-rank-diff {
    font-size: 11.5px;
    color: var(--text-muted);
}

.cmp-hotel-section {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    padding: 14px;
    margin-bottom: 14px;
}

.cmp-hotel-section.is-lowest-hotel {
    border-color: #93c5fd;
    background: #f5f9ff;
}

.cmp-hotel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cmp-hotel-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.cmp-hotel-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* 비교 그룹 생성/편집기 */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.cmp-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cmp-items-header h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 800;
}

.cmp-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cmp-item-box {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--bg-subtle);
}

.cmp-item-top {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.cmp-room-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 6px;
    max-height: 190px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.cmp-room-check {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 13px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.cmp-room-check:hover {
    background: var(--bg-muted);
}

.cmp-room-check input {
    margin-top: 2px;
    accent-color: var(--primary);
}

.modal-footer {
    padding: 13px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ==========================================================================
   반응형 (모바일 핵심 최적화 <= 768px / <= 640px)
   ========================================================================== */
@media (max-width: 768px) {
    .topbar-inner {
        padding: 10px 14px;
    }

    .mode-tabs {
        order: 3;
        width: 100%;
    }

    .mode-tab {
        flex: 1;
        padding: 8px 10px;
    }

    .main-container {
        padding: 12px 12px 36px;
        gap: 12px;
    }

    .control-panel {
        padding: 13px;
    }

    /* iOS Safari 자동 줌 방지를 위해 모바일 select/input 글자 크기 16px 보장 */
    .form-select,
    .modal-search-input {
        font-size: 16px;
        height: 42px;
    }

    .control-group {
        flex: 1 1 calc(50% - 6px);
    }

    .control-hotel {
        flex: 1 1 100%;
    }

    .compare-select-actions {
        flex-wrap: wrap;
    }

    .compare-select-actions .form-select {
        flex: 1 1 100%;
    }

    .legend-items {
        display: none;
    }

    .summary-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .summary-card {
        padding: 10px 12px;
    }

    .summary-card-value {
        font-size: 16px;
    }

    /* 모바일 풀 바텀시트 모달 */
    .modal-backdrop {
        padding: 0;
        align-items: flex-end;
    }

    .modal-sheet {
        width: 100%;
        height: 94dvh;
        max-height: 94dvh;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: sheet-up 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes sheet-up {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .modal-header {
        padding: 14px 15px 10px;
    }

    .modal-title {
        font-size: 17px;
    }

    .modal-Toolbar {
        padding: 9px 15px;
    }

    .modal-body {
        padding: 12px 14px 28px;
    }

    .modal-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .kpi-box {
        padding: 9px 11px;
    }

    .kpi-val {
        font-size: 15.5px;
    }

    /* 모바일 요금제 레이아웃: 가독성 극대화 2단 구성 */
    .offer-main-row {
        flex-direction: column;
        gap: 10px;
    }

    .offer-price-col {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding-top: 8px;
        border-top: 1px dashed var(--border-color);
    }

    .offer-price-box-mobile {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .offer-action-box-mobile {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        margin-left: auto;
    }

    .form-row-2,
    .cmp-item-top {
        grid-template-columns: 1fr;
    }
}

/* 초소형 모바일 달력 셀 최적화 (<= 640px) */
@media (max-width: 640px) {
    .calendar-weekdays > div {
        padding: 7px 2px;
        font-size: 11.5px;
    }

    .cal-cell {
        min-height: 76px;
        padding: 5px 4px;
    }

    .cal-day-num {
        font-size: 12px;
    }

    .today-dot {
        display: none;
    }

    .cal-cell.is-today .cal-day-num {
        background: var(--primary);
        color: #fff;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        justify-content: center;
    }

    .cal-change-badge {
        font-size: 9.5px;
        padding: 1px 4px;
    }

    .cal-price-full,
    .cal-room-hint,
    .cmp-cell-list {
        display: none;
    }

    .cal-price-compact {
        display: block;
        font-size: 12px;
        font-weight: 800;
        color: var(--text-main);
        letter-spacing: -0.03em;
        line-height: 1.2;
    }

    .cal-soldout-label {
        font-size: 10px;
        padding: 1px 4px;
    }

    .cal-foot {
        margin-top: 3px;
        font-size: 9.5px;
    }
}
