@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-main: #0a0c10;
    --bg-card: #13161c;
    --bg-card-hover: #181d26;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #6366f1;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent: #4f46e5;
    --accent-hover: #6366f1;
    --accent-light: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --transition-speed: 0.25s;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Sidebar Navigation (Mobile Drawer Only) */
.sidebar {
    width: 280px;
    max-width: 85vw;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 10002;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
}

.sidebar.mobile-open {
    transform: translateX(0) !important;
}

/* =================================================================
   🚀 TOP NAVIGATION BAR (상단 와이드 통합 메뉴바: 화면 가로 100% 확장)
   ================================================================= */
.top-navbar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    z-index: 1000;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

body.theme-light .top-navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(203, 213, 225, 0.85);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    flex-shrink: 0;
}

.top-nav-divider {
    height: 20px;
    width: 1px;
    background-color: var(--border-color);
}

.top-nav-center {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 0.5rem;
}
.top-nav-center::-webkit-scrollbar {
    display: none;
}

.top-nav-links {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-nav-links .nav-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.top-nav-links .nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.07);
}

body.theme-light .top-nav-links .nav-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.top-nav-links .nav-item.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3)) !important;
    border: 1px solid rgba(99, 102, 241, 0.5) !important;
    border-left: 1px solid rgba(99, 102, 241, 0.5) !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
}

body.theme-light .top-nav-links .nav-item.active {
    color: var(--accent) !important;
    background: rgba(99, 102, 241, 0.12) !important;
    border: 1px solid rgba(99, 102, 241, 0.4) !important;
    border-left: 1px solid rgba(99, 102, 241, 0.4) !important;
}

.top-nav-links .nav-item svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.top-nav-left .account-selector-container {
    margin-bottom: 0;
    position: relative;
}

.top-nav-left .account-selector {
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    gap: 0.4rem;
}

body.theme-light .top-nav-left .account-selector {
    background-color: rgba(0, 0, 0, 0.03);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.15rem;
    color: white;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(to right, #ffffff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.nav-item:hover, .nav-item.active {
    color: white;
    background-color: var(--accent-light);
}

.nav-item.active {
    border-left: 3px solid var(--border-focus);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

/* Main Content Area - 100% Wide Desktop Layout */
.main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.75rem 2rem 3.5rem 2rem;
    flex-grow: 1;
    transition: none;
}

@media (min-width: 993px) {
    .sidebar {
        display: none !important;
    }
    .top-navbar .mobile-menu-trigger {
        display: none !important;
    }
}

@media (max-width: 992px) {
    .top-nav-center {
        display: none !important;
    }
    .top-navbar .mobile-menu-trigger {
        display: inline-flex !important;
    }
    .main-content {
        padding: 1rem 1rem 88px 1rem !important;
    }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.85rem;
    letter-spacing: -0.02em;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.status-badge.running {
    background-color: var(--success-light);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.status-badge.stopped {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

/* Dashboard Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue {
    background-color: var(--accent-light);
    color: var(--accent-hover);
}

.stat-icon.green {
    background-color: var(--success-light);
    color: var(--success);
}

.stat-icon.red {
    background-color: var(--danger-light);
    color: var(--danger);
}

.stat-icon.yellow {
    background-color: var(--warning-light);
    color: var(--warning);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
}

/* Sections & Cards */
.section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

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

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input, select, textarea {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-speed) ease;
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--border-focus);
}

/* Toggle Switch */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #374151;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Tables */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

/* 광고소재 입찰 세팅창 및 제외 관리창 와이드 확장 (옵션 컬럼 짤림 방지) */
#rule-modal .modal-content {
    max-width: 1040px !important;
    width: 95% !important;
}

#negative-rule-modal .modal-content {
    max-width: 960px !important;
    width: 95% !important;
}

/* 입찰 세팅창 및 제외 관리창의 2열 그리드 레이아웃 고정 (이전 UI 위치 완벽 보존) */
@media (min-width: 993px) {
    #rule-modal .form-grid,
    #negative-rule-modal .form-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem !important;
    }
}

/* 노출 기기 항목 1행 전체 차지 및 셀렉트 100% 확장 */
#rule-device-group,
#bulk-device-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}
#rule-device-group select,
#bulk-device-group select {
    width: 100% !important;
}

/* 모든 숫자 및 금액 입력 필드 오른쪽 정렬 */
.modal-content input[type="number"],
.modal-content input[inputmode="numeric"],
.modal-content input.money-input,
.modal-content input.numeric-input,
.rule-opt-price,
.rule-opt-disc-price,
.rule-opt-cost,
.rule-opt-margin,
#rule-product-margin-display,
#rule-cvr-7d-display,
#rule-cvr-14d-display,
#rule-target-cvr,
#rule-target-roas,
#calculated_max_cpc,
#calculated_test_clicks,
#rule-momentum-max-bid-preview,
#rule-test-clicks-multiplier,
#bulk-target-cvr,
#bulk-target-roas,
#bulk-calculated_max_cpc,
#bulk-calculated_test_clicks,
#bulk-test-clicks-multiplier,
#neg-pl-calculated-display {
    text-align: right !important;
    text-align-last: right !important;
}

#rule-test-clicks-multiplier,
#bulk-test-clicks-multiplier {
    padding-right: 1.75rem !important;
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-hover);
    animation: spin 1s ease-in-out infinite;
}

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

/* Console logs style */
.log-terminal {
    background-color: #05070a;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: #a3b8cc;
    padding: 1.25rem;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.log-entry {
    margin-bottom: 0.35rem;
    line-height: 1.4;
}
.log-time { color: var(--text-muted); }
.log-info { color: #38bdf8; }
.log-warn { color: var(--warning); }
.log-error { color: var(--danger); }

/* Bidding Rules Tabs */
.bidding-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.bidding-tab {
    padding: 0.85rem 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-speed) ease;
}

.bidding-tab:hover {
    color: white;
}

.bidding-tab.active {
    color: white;
    border-bottom-color: var(--border-focus);
}

/* Sidebar Collapse Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 2rem;
    right: -14px;
    width: 28px;
    height: 28px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    outline: none;
}

.sidebar-toggle:hover {
    color: white;
    background-color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transitions for collapsible text elements */
.logo-text, .nav-text {
    white-space: nowrap;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 200px;
    display: inline-block;
    vertical-align: middle;
}

/* Collapsed Sidebar Rules */
body.sidebar-collapsed .sidebar {
    display: none !important;
}

body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

body.sidebar-collapsed .logo-container {
    justify-content: center;
    gap: 0;
    margin-bottom: 2.5rem;
}

body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-text {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    margin: 0;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.85rem 0;
    gap: 0;
}

body.sidebar-collapsed .nav-item.active {
    border-left-width: 0;
    background-color: var(--accent-light);
    box-shadow: inset 3px 0 0 0 var(--border-focus);
}

body.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Click Logs sorting interactive headers */
th[onclick] {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-speed) ease;
}

th[onclick]:hover {
    color: white;
}

th[onclick] span {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.8rem;
    transition: color var(--transition-speed) ease;
}

/* Collapsible guide details & summary styling */
details.rec-guide-details summary::-webkit-details-marker {
    display: none;
}
details.rec-guide-details summary {
    list-style: none;
}
details.rec-guide-details {
    transition: all 0.3s ease;
}
details.rec-guide-details[open] {
    border-color: var(--border-focus) !important;
}

/* Bidding adgroup folder row hover styles */
.adgroup-folder-row:hover {
    background-color: rgba(16, 185, 129, 0.08) !important;
}

/* Modern Toggle Switch Styling */
.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    margin: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .2s;
    border-radius: 18px;
}
.switch .slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .2s;
    border-radius: 50%;
}
.switch input:checked + .slider {
    background-color: #10b981 !important;
}
.switch input:checked + .slider:before {
    transform: translateX(14px);
}
.switch-label-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Bulk Edit Modal Styling */
.bulk-field-toggle {
    width: 14px;
    height: 14px;
    cursor: pointer;
}
#bulk-edit-modal input:disabled, 
#bulk-edit-modal select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.01) !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-muted) !important;
}
.accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
.accordion-item.active {
    border-color: var(--border-focus) !important;
}
.accordion-arrow {
    transition: transform 0.2s ease;
}
.accordion-item.active .accordion-arrow {
    transform: rotate(180deg);
}

/* Account Switcher Styling */
.account-selector-container {
    position: relative;
    margin-bottom: 2rem;
    width: 100%;
}

.account-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    user-select: none;
}

.account-selector:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.account-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
}

.account-name {
    flex-grow: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--transition-speed) ease;
}

.chevron-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform var(--transition-speed) ease;
}

.account-selector.active .chevron-icon {
    transform: rotate(180deg);
}

.account-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background-color: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 50;
    overflow: hidden;
}

.account-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.account-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.account-dropdown-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.account-dropdown-item.active {
    color: white;
    background-color: var(--accent-light);
    font-weight: 600;
}

/* Collapsed Sidebar overrides for Account Switcher */
body.sidebar-collapsed .account-selector-container {
    margin-bottom: 1.5rem;
}

body.sidebar-collapsed .account-selector {
    justify-content: center;
    padding: 0.75rem 0;
}

body.sidebar-collapsed .account-name,
body.sidebar-collapsed .chevron-icon {
    display: none;
}

body.sidebar-collapsed .account-dropdown {
    width: 180px;
    left: calc(100% + 10px);
    top: 0;
}

/* =================================================================
   ☀️ LIGHT THEME SYSTEM PALETTE (라이트 모드 고대비 가독성 최적화 시스템)
   ================================================================= */
body.theme-light {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #cbd5e1;
    --border-focus: #4338ca;
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
    
    --accent: #4338ca;
    --accent-hover: #3730a3;
    --accent-light: #eef2ff;
    
    --success: #047857;
    --success-light: #ecfdf5;
    
    --warning: #b45309;
    --warning-light: #fffbeb;
    
    --danger: #b91c1c;
    --danger-light: #fef2f2;
    
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* 1. 사이드바 및 전역 네비게이션 */
body.theme-light .sidebar {
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

body.theme-light .logo-text span:first-child {
    background: linear-gradient(135deg, #0f172a 30%, #475569) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.theme-light .account-selector {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

body.theme-light .account-name {
    color: #0f172a;
    font-weight: 700;
}

body.theme-light .account-dropdown {
    background-color: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

body.theme-light .account-dropdown-item {
    color: #334155;
}

body.theme-light .account-dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

body.theme-light .nav-item {
    color: #475569;
    font-weight: 600;
}

body.theme-light .nav-item:hover,
body.theme-light .nav-item.active {
    color: #4338ca;
    background-color: #eef2ff;
    font-weight: 700;
}

body.theme-light .theme-toggle-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
}

body.theme-light .theme-toggle-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

body.theme-light .theme-toggle-btn svg {
    stroke: #334155 !important;
}

/* 2. 상단 헤더 뱃지 및 가이드 버튼 */
body.theme-light #fe-version-badge {
    background: #eef2ff !important;
    border: 1px solid #a5b4fc !important;
    color: #3730a3 !important;
    font-weight: 700 !important;
}

body.theme-light #btn-user-guide {
    background: #ffffff !important;
    border: 1.5px solid #6366f1 !important;
    color: #4338ca !important;
    font-weight: 700 !important;
}

body.theme-light #btn-user-guide svg {
    stroke: #4338ca !important;
}

body.theme-light #btn-user-guide:hover {
    background: #eef2ff !important;
    color: #312e81 !important;
}

body.theme-light .status-badge {
    background: #ecfdf5 !important;
    border: 1px solid #6ee7b7 !important;
    color: #065f46 !important;
    font-weight: 700 !important;
}

/* 3. 대시보드 통계 카드 (Stat Cards) */
body.theme-light .stat-card {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

body.theme-light .stat-card:hover {
    border-color: #94a3b8;
}

body.theme-light .stat-label {
    color: #334155 !important;
    font-weight: 600 !important;
}

body.theme-light .stat-value {
    color: #0f172a !important;
    font-weight: 800 !important;
}

body.theme-light .stat-icon.blue {
    background-color: #eef2ff;
    color: #3730a3;
}

body.theme-light .stat-icon.green {
    background-color: #ecfdf5;
    color: #047857;
}

body.theme-light .stat-icon.red {
    background-color: #fef2f2;
    color: #b91c1c;
}

body.theme-light .stat-icon.yellow {
    background-color: #fffbeb;
    color: #b45309;
}

/* 4. 메인 패널 및 탭 */
body.theme-light .panel {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

body.theme-light .panel-title {
    color: #0f172a !important;
    font-weight: 700 !important;
}

body.theme-light .bidding-tab {
    color: #475569;
    font-weight: 600;
}

body.theme-light .bidding-tab.active {
    color: #4338ca;
    border-bottom-color: #4338ca;
    font-weight: 700;
}

/* 5. 버튼 시스템 */
body.theme-light .btn-secondary {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.theme-light .btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

body.theme-light #btn-toggle-expand-negative {
    background: #eef2ff !important;
    border: 1.5px solid #a5b4fc !important;
    color: #3730a3 !important;
    font-weight: 700 !important;
}

body.theme-light #btn-toggle-expand-negative:hover {
    background: #e0e7ff !important;
    color: #1e1b4b !important;
}

body.theme-light #btn-export-analysis-excel {
    background: #ecfdf5 !important;
    border: 1.5px solid #6ee7b7 !important;
    color: #047857 !important;
    font-weight: 700 !important;
}

body.theme-light #btn-export-analysis-excel:hover {
    background: #d1fae5 !important;
    color: #064e3b !important;
}

body.theme-light #btn-reset-analysis,
body.theme-light #btn-clear-recs {
    background: #fef2f2 !important;
    border: 1.5px solid #fca5a5 !important;
    color: #b91c1c !important;
    font-weight: 700 !important;
}

body.theme-light #btn-reset-analysis:hover,
body.theme-light #btn-clear-recs:hover {
    background: #fee2e2 !important;
    color: #7f1d1d !important;
}

body.theme-light .fetch-stats-btn,
body.theme-light .sync-names-btn {
    background: #eef2ff !important;
    border-color: #a5b4fc !important;
    color: #3730a3 !important;
    font-weight: 700 !important;
}

body.theme-light #btn-bulk-edit {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    font-weight: 600 !important;
}

/* 6. 성과 분석 및 진행 상황 콘솔 (Console) */
body.theme-light #analysis-progress-container,
body.theme-light #bidding-progress-container {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

body.theme-light #analysis-progress-message,
body.theme-light #bidding-progress-message {
    color: #0f172a !important;
    font-weight: 700 !important;
}

body.theme-light #analysis-progress-percent,
body.theme-light #bidding-progress-percent {
    color: #4338ca !important;
    font-weight: 800 !important;
}

body.theme-light #analysis-console,
body.theme-light .log-terminal {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-weight: 500 !important;
}

body.theme-light #analysis-console > div,
body.theme-light #analysis-console span {
    color: #334155 !important;
}

body.theme-light #analysis-console div[style*="color: var(--text-muted)"] {
    color: #475569 !important;
    font-weight: 500 !important;
}

/* 7. 트리 / 폴더 구조 (캠페인 행 및 광고그룹 행) */
body.theme-light .campaign-folder-row {
    background: #f1f5f9 !important;
    border-left: 4px solid #4338ca !important;
}

body.theme-light .campaign-folder-row:hover {
    background: #e2e8f0 !important;
}

body.theme-light .campaign-folder-row .badge {
    background-color: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #a5b4fc !important;
    font-weight: 700 !important;
}

body.theme-light .campaign-folder-row span[style*="var(--text-primary)"],
body.theme-light .campaign-folder-row b {
    color: #0f172a !important;
    font-weight: 700 !important;
}

body.theme-light .adgroup-folder-row {
    background: #f8fafc !important;
    border-left: 4px solid #059669 !important;
}

body.theme-light .adgroup-folder-row:hover {
    background: #f1f5f9 !important;
}

body.theme-light .adgroup-folder-row .badge {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #6ee7b7 !important;
    font-weight: 700 !important;
}

body.theme-light .adgroup-folder-row span[style*="text-decoration: underline"] {
    color: #0f172a !important;
    font-weight: 700 !important;
    text-decoration: underline !important;
    text-decoration-style: dashed !important;
    text-decoration-color: #059669 !important;
    text-underline-offset: 4px !important;
}

/* 8. 테이블 시스템 전역 (Table & Cells) */
body.theme-light .table-container table {
    background-color: #ffffff;
}

body.theme-light .table-container th,
body.theme-light table th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    font-size: 0.82rem !important;
}

body.theme-light .table-container td,
body.theme-light table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

body.theme-light tr:hover td {
    background-color: #f8fafc !important;
}

body.theme-light td[colspan] {
    color: #475569 !important;
    font-weight: 600 !important;
}

/* 9. 상태 뱃지 전역 (Badges) */
body.theme-light .badge-success {
    background-color: #ecfdf5 !important;
    color: #065f46 !important;
    border: 1px solid #6ee7b7 !important;
    font-weight: 700 !important;
}

body.theme-light .badge-warning {
    background-color: #fffbeb !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
    font-weight: 700 !important;
}

body.theme-light .badge-danger {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fca5a5 !important;
    font-weight: 700 !important;
}

body.theme-light .badge-info {
    background-color: #f0f9ff !important;
    color: #075985 !important;
    border: 1px solid #7dd3fc !important;
    font-weight: 700 !important;
}

/* 10. 모달 및 폼 입력 컨트롤 */
body.theme-light .modal-content {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

body.theme-light .modal-header h3,
body.theme-light .modal-header h4,
body.theme-light .modal-content h3,
body.theme-light .modal-content h4 {
    color: #0f172a !important;
    font-weight: 800 !important;
}

body.theme-light .modal-close {
    color: #64748b !important;
}

body.theme-light .modal-close:hover {
    color: #0f172a !important;
}

body.theme-light .form-group label,
body.theme-light label {
    color: #1e293b !important;
    font-weight: 600 !important;
}

body.theme-light .form-group input,
body.theme-light .form-group select,
body.theme-light .form-group textarea,
body.theme-light input[type="text"],
body.theme-light input[type="number"],
body.theme-light input[type="password"],
body.theme-light select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #cbd5e1 !important;
}

body.theme-light input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus {
    border-color: #4338ca !important;
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.12) !important;
}

body.theme-light .form-text,
body.theme-light small,
body.theme-light p.help-text {
    color: #475569 !important;
    font-weight: 500 !important;
}

/* 11. 추천 안내 아코디언 가이드 */
body.theme-light details.rec-guide-details {
    background-color: #fffbeb !important;
    border: 1px solid #fde68a !important;
}

body.theme-light details.rec-guide-details summary {
    color: #713f12 !important;
    font-weight: 700 !important;
}

body.theme-light details.rec-guide-details .toggle-text {
    background: #fef3c7 !important;
    border: 1px solid #fde68a !important;
    color: #854d0e !important;
    font-weight: 700 !important;
}

body.theme-light details.rec-guide-details div,
body.theme-light details.rec-guide-details p {
    color: #713f12 !important;
}

/* 12. AI 챗봇 비서 패널 */
body.theme-light #ai-chat-panel {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15) !important;
}

body.theme-light #ai-chat-panel > div:first-child {
    background: linear-gradient(135deg, #eef2ff, #f5f3ff) !important;
    border-bottom: 1px solid #c7d2fe !important;
}

body.theme-light #ai-chat-panel h4 {
    color: #1e1b4b !important;
    font-weight: 700 !important;
}

body.theme-light #btn-clear-ai-chat {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

body.theme-light #btn-maximize-ai-chat,
body.theme-light #ai-chat-panel button[title="닫기"] {
    color: #475569 !important;
}

body.theme-light #ai-chat-messages {
    background: #f8fafc !important;
}

body.theme-light #ai-chat-messages > div:first-child {
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
    color: #1e1b4b !important;
    font-weight: 500 !important;
}

body.theme-light #ai-chat-messages > div[style*="align-self: flex-start"] {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

body.theme-light #ai-chat-panel div[style*="background: rgba(15, 23, 42"] {
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
}

body.theme-light #ai-chat-panel div[style*="background: rgba(15, 23, 42"] button {
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
    color: #3730a3 !important;
    font-weight: 600 !important;
}

body.theme-light #ai-chat-input {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    color: #0f172a !important;
}

/* 13. 전역 인라인 다크 컬러 오버라이드 (High Contrast Fallback & Precision Overrides) */
body.theme-light [style*="color: #a5b4fc"],
body.theme-light [style*="color:#a5b4fc"],
body.theme-light [style*="color: #818cf8"],
body.theme-light [style*="color:#818cf8"],
body.theme-light [style*="color: #c7d2fe"],
body.theme-light [style*="color:#c7d2fe"],
body.theme-light [style*="color: #e0e7ff"] {
    color: #4338ca !important;
}

body.theme-light [style*="color: #34d399"],
body.theme-light [style*="color:#34d399"],
body.theme-light [style*="color: #4ade80"],
body.theme-light [style*="color:#4ade80"],
body.theme-light [style*="color: #10b981"],
body.theme-light [style*="color:#10b981"] {
    color: #047857 !important;
}

body.theme-light [style*="color: #38bdf8"],
body.theme-light [style*="color:#38bdf8"],
body.theme-light [style*="color: #60a5fa"],
body.theme-light [style*="color:#60a5fa"] {
    color: #0369a1 !important;
}

body.theme-light [style*="color: #f87171"],
body.theme-light [style*="color:#f87171"],
body.theme-light [style*="color: #ef4444"],
body.theme-light [style*="color:#ef4444"] {
    color: #b91c1c !important;
}

body.theme-light [style*="color: #fbbf24"],
body.theme-light [style*="color:#fbbf24"],
body.theme-light [style*="color: #f59e0b"],
body.theme-light [style*="color:#f59e0b"] {
    color: #b45309 !important;
}

body.theme-light [style*="color: #94a3b8"],
body.theme-light [style*="color:#94a3b8"],
body.theme-light [style*="color: #9ca3af"],
body.theme-light [style*="color:#9ca3af"] {
    color: #475569 !important;
}

body.theme-light [style*="background: rgba(15, 23, 42"],
body.theme-light [style*="background-color: rgba(15, 23, 42"],
body.theme-light [style*="background: rgba(0,0,0"],
body.theme-light [style*="background: rgba(0, 0, 0"],
body.theme-light [style*="background-color: rgba(0,0,0"],
body.theme-light [style*="background-color: rgba(0, 0, 0"],
body.theme-light [style*="background: #090d16"],
body.theme-light [style*="background-color: #090d16"],
body.theme-light [style*="background: #0f172a"],
body.theme-light [style*="background-color: #0f172a"] {
    background: #f8fafc !important;
    background-color: #f8fafc !important;
}

body.theme-light [style*="background: rgba(255, 255, 255"],
body.theme-light [style*="background: rgba(255,255,255"],
body.theme-light [style*="background-color: rgba(255, 255, 255"],
body.theme-light [style*="background-color: rgba(255,255,255"] {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important;
}

body.theme-light [style*="border: 1px solid rgba(255, 255, 255"],
body.theme-light [style*="border: 1px solid rgba(255,255,255"],
body.theme-light [style*="border-color: rgba(255, 255, 255"],
body.theme-light [style*="border-color: rgba(255,255,255"] {
    border-color: #cbd5e1 !important;
}

/* ==========================================================================
   📱 MOBILE RESPONSIVE ADAPTATIONS (아이디어 1, 2, 3, 4)
   - PC 화면(769px 이상)에서는 100% 기존 스타일 유지
   - 스마트폰 화면(768px 이하)에서만 전용 모바일 앱 UI 자동 발동
   ========================================================================== */

/* PC 기본 상태: 모바일 전용 요소 완벽 숨김 */
.mobile-bottom-nav {
    display: none;
}
.mobile-menu-trigger {
    display: none;
}
.sidebar-backdrop {
    display: none;
}

@keyframes slideUpBottomSheet {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 992px), (max-width: 1024px) and (hover: none) and (pointer: coarse), (max-width: 1024px) and (pointer: coarse) {
    /* 1. 기본 레이아웃 & 본문 여백 확장 (아이디어 ①) */
    body {
        overflow-x: hidden;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 0.85rem 0.85rem 88px 0.85rem !important; /* 하단 탭바 가림 방지 */
        overflow-x: hidden !important;
    }

    /* 모바일 환경에서는 PC의 sidebar-collapsed 상태를 무력화하고 모바일 드로어 전용 스타일 강제 적용 */
    body.sidebar-collapsed .sidebar {
        width: 280px !important;
        max-width: 85vw !important;
        padding: 1.5rem 1rem !important;
        transform: translateX(-105%) !important;
    }
    body.sidebar-collapsed .sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    body.sidebar-collapsed .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    body.sidebar-collapsed .logo-text,
    body.sidebar-collapsed .nav-text {
        opacity: 1 !important;
        visibility: visible !important;
        max-width: 200px !important;
        margin: initial !important;
    }
    body.sidebar-collapsed .nav-item {
        justify-content: flex-start !important;
        padding: 0.85rem 1rem !important;
        gap: 0.75rem !important;
    }
    body.sidebar-collapsed .logo-container {
        justify-content: flex-start !important;
        gap: 0.75rem !important;
        margin-bottom: 2rem !important;
    }

    /* 2. 좌측 사이드바 ➔ 슬라이드 드로어(Drawer) 변환 (아이디어 ①) */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 10002 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6) !important;
        padding: 1.5rem 1rem !important;
    }
    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    .sidebar-toggle {
        display: none !important;
    }

    /* 사이드바 어두운 배경(Backdrop) */
    .sidebar-backdrop {
        display: none;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 10001 !important;
        opacity: 0;
        transition: opacity 0.25s ease !important;
    }
    .sidebar-backdrop.active {
        display: block !important;
        opacity: 1 !important;
    }

    /* 3. 모바일 상단 헤더 & 햄버거 버튼 (아이디어 ①) */
    .mobile-menu-trigger {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid var(--border-color) !important;
        color: var(--text-primary) !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
    }
    body.theme-light .mobile-menu-trigger {
        background: #ffffff !important;
        border-color: #cbd5e1 !important;
    }
    .header {
        margin-bottom: 1.25rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    .header-left {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
    .page-title {
        font-size: 1.35rem !important;
        font-weight: 700 !important;
        letter-spacing: -0.3px !important;
    }
    .header-right {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    #fe-version-badge {
        display: none !important; /* 모바일에서 긴 버전 뱃지 숨김 */
    }
    #system-status {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.75rem !important;
    }
    #btn-user-guide {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.75rem !important;
    }

    /* 4. 모바일 최하단 고정 탭바 (아이디어 ①) */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 64px !important;
        min-height: 64px !important;
        background: rgba(15, 23, 42, 0.98) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
        z-index: 9999 !important;
        justify-content: space-around !important;
        align-items: center !important;
        padding: 4px 4px max(4px, env(safe-area-inset-bottom, 0px)) 4px !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45) !important;
    }
    body.theme-light .mobile-bottom-nav {
        background: rgba(255, 255, 255, 0.98) !important;
        border-top: 1px solid #e2e8f0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
    }
    .mobile-nav-btn {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        background: none !important;
        border: none !important;
        color: #94a3b8 !important;
        font-size: 0.76rem !important;
        font-weight: 600 !important;
        letter-spacing: -0.4px !important;
        white-space: nowrap !important;
        padding: 4px 2px !important;
        cursor: pointer !important;
        outline: none !important;
        -webkit-tap-highlight-color: transparent !important;
        transition: all 0.2s ease !important;
        min-width: 0 !important;
    }
    body.theme-light .mobile-nav-btn {
        color: #64748b !important;
    }
    .mobile-nav-btn span {
        display: block !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
    }
    .mobile-nav-btn svg {
        width: 22px !important;
        height: 22px !important;
        stroke: currentColor !important;
        stroke-width: 2.1 !important;
        transition: transform 0.2s ease !important;
        flex-shrink: 0 !important;
    }
    .mobile-nav-btn.active {
        color: #6366f1 !important;
        font-weight: 700 !important;
    }
    body.theme-light .mobile-nav-btn.active {
        color: #4f46e5 !important;
        font-weight: 700 !important;
    }
    .mobile-nav-btn.active svg {
        transform: translateY(-2px) scale(1.08) !important;
        stroke: #6366f1 !important;
    }
    body.theme-light .mobile-nav-btn.active svg {
        stroke: #4f46e5 !important;
    }

    /* 5. 상단 요약 통계 2x2 정렬 (아이디어 ②) */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
        margin-bottom: 1.25rem !important;
    }
    .stat-card {
        padding: 0.85rem !important;
        gap: 0.65rem !important;
        border-radius: 12px !important;
    }
    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 8px !important;
    }
    .stat-icon svg {
        width: 18px !important;
        height: 18px !important;
    }
    .stat-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.15rem !important;
    }
    .stat-value {
        font-size: 1.35rem !important;
    }

    /* 6. 가로 스와이프 필(Pill) 툴바 (아이디어 ④) */
    .panel-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
    .panel-header-actions {
        width: 100% !important;
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        gap: 0.4rem !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 6px !important;
        scrollbar-width: none !important;
    }
    .panel-header-actions::-webkit-scrollbar {
        display: none !important;
    }
    .bidding-tabs {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }
    .click-period-btn {
        flex-shrink: 0 !important;
    }
    /* 상태/기간 필터 세그먼트 가로 스크롤 허용 */
    [style*="display: inline-flex"][style*="background: rgba(255, 255, 255, 0.05)"],
    [style*="display:inline-flex"][style*="background:rgba(255,255,255,0.05)"] {
        overflow-x: auto !important;
        max-width: 100% !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }

    /* 7. 대형 테이블 가로 스와이프 및 터치 최적화 (아이디어 ②) */
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 10px !important;
        width: 100% !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15) !important;
    }
    .table-container table {
        min-width: 780px !important; /* 컬럼이 찌그러지지 않고 가로 스크롤되도록 보장 */
    }
    th, td {
        padding: 0.65rem 0.5rem !important;
        font-size: 0.8rem !important;
    }

    /* 8. 모바일 바텀시트(Bottom Sheet) 모달 (아이디어 ③) */
    .modal {
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 0 !important;
    }
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 88vh !important;
        padding: 1.25rem 1rem 2rem 1rem !important;
        margin: 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6) !important;
        animation: slideUpBottomSheet 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    }
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px !important; /* iOS 사파리 자동 확대(줌인) 원천 차단 */
    }
    .modal-content .form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem !important;
    }
    .modal-content button[type="submit"],
    .modal-content .btn-primary {
        min-height: 44px !important; /* 엄지손가락 터치 최적화 규격 */
        font-size: 0.95rem !important;
    }

    /* 9. AI 비서 플로팅 위젯 위치 조정 */
    #ai-chat-floating-container {
        bottom: 76px !important;
        right: 12px !important;
    }
    #ai-chat-panel {
        bottom: 70px !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 75vh !important;
        border-radius: 16px 16px 0 0 !important;
    }
}

/* 🎯 운영 목적별 6대 전략 엔진 가이드 그리드 (3열 배열) */
.bidding-scenario-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.85rem !important;
    margin-bottom: 0.5rem !important;
}

@media (max-width: 1180px) {
    .bidding-scenario-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .bidding-scenario-grid {
        grid-template-columns: 1fr !important;
    }
}

/* =================================================================
   ⬆️ SCROLL TO TOP FLOATING BUTTON (맨 위로 이동 플로팅 버튼)
   ================================================================= */
.btn-scroll-top {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e1b4b, #3b82f6);
    color: #ffffff;
    border: 1.5px solid rgba(147, 197, 253, 0.45);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 14px rgba(59, 130, 246, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.9);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s, background 0.2s, box-shadow 0.2s, border-color 0.2s;
    pointer-events: none;
    outline: none;
    user-select: none;
    flex-shrink: 0;
}

.btn-scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.btn-scroll-top:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    border-color: #e0e7ff;
    color: #ffffff;
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6), 0 0 18px rgba(168, 85, 247, 0.45);
}

.btn-scroll-top:active {
    transform: translateY(0) scale(0.95);
}

body.theme-light .btn-scroll-top {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}


