/* ============================================
   GMMS - Bootstrap 5 Custom Override
   ============================================ */

/* Override Bootstrap primary → indigo */
:root {
    --bs-primary: #6366F1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-link-color: #6366F1;
    --bs-link-hover-color: #4F46E5;
    --brand-orange: #F5A01E;
    --brand-red:    #E8441F;
    --sidebar-w:    200px;
}

.btn-primary {
    --bs-btn-bg:                #6366F1;
    --bs-btn-border-color:      #6366F1;
    --bs-btn-hover-bg:          #4F46E5;
    --bs-btn-hover-border-color:#4F46E5;
    --bs-btn-active-bg:         #4338CA;
    --bs-btn-active-border-color:#4338CA;
    --bs-btn-focus-shadow-rgb:  99,102,241;
}

.btn-outline-primary {
    --bs-btn-color:             #6366F1;
    --bs-btn-border-color:      #6366F1;
    --bs-btn-hover-bg:          #6366F1;
    --bs-btn-hover-border-color:#6366F1;
    --bs-btn-active-bg:         #4F46E5;
}

.text-primary { color: #6366F1 !important; }
a            { color: #6366F1; }
a:hover      { color: #4F46E5; }

/* ============================
   Font size utilities (Bootstrap fs-1~6 은 40/32/28/24/20/16px 만 커버 →
   그보다 작은 크기를 위한 보조 클래스. rem 기준(1rem=16px)으로 정의해
   fs-* 와 동일한 방식(브라우저 기본 폰트 크기 변경에 반응)을 따른다.)
   ============================ */
.fsx-15 { font-size: 0.9375rem !important; } /* 15px */
.fsx-14 { font-size: 0.875rem  !important; } /* 14px */
.fsx-13 { font-size: 0.8125rem !important; } /* 13px */
.fsx-12 { font-size: 0.75rem   !important; } /* 12px */
.fsx-11 { font-size: 0.6875rem !important; } /* 11px */
.fsx-10 { font-size: 0.625rem  !important; } /* 10px */
.fsx-9  { font-size: 0.5625rem !important; } /* 9px */

/* ============================
   Sidebar
   ============================ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 1030;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #E5E7EB;
}

.sidebar-brand {
    padding: 16px 14px 14px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.brand-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-orange);
    letter-spacing: -.5px;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 3px;
    font-weight: 500;
    line-height: 1.4;
}

.brand-sub .m { color: var(--brand-orange); font-weight: 800; }

.sidebar-nav { flex: 1; padding: 10px 8px; }

.sidebar .nav-link {
    color: #6B7280;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all .15s;
    margin-bottom: 2px;
}

.sidebar .nav-link:hover { background: #F3F4F6; color: #1F2937; }

.sidebar .nav-link.active {
    background: #EEF0FF;
    color: #6366F1;
    font-weight: 600;
}

.sidebar .nav-link i { font-size: 15px; opacity: .75; }
.sidebar .nav-link.active i { opacity: 1; }

.sidebar .sub-nav { padding-left: 35px; margin-top: 2px; }

.sidebar .sub-link {
    display: block;
    color: #6B7280;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    margin-bottom: 1px;
    transition: all .15s;
}

.sidebar .sub-link:hover { background: #F3F4F6; color: #1F2937; }

.sidebar .sub-link.active {
    background: #EEF0FF;
    color: #6366F1;
    font-weight: 600;
}

.nav-divider { height: 1px; background: #E5E7EB; margin: 6px 4px; }

.sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid #E5E7EB;
    font-size: 11px;
    color: #9CA3AF;
    text-align: center;
    flex-shrink: 0;
}

/* ============================
   Main content
   ============================ */
.main-content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #F5F7FA;
    overflow-x: auto;
}

/* ============================
   Topbar
   ============================ */
.topbar {
    height: 52px;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #6366F1;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}

/* ============================
   Page content
   ============================ */
.page-content { padding: 24px; flex: 1; }

.page-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: #1F2937;
}

/* ============================
   Card overrides
   ============================ */
.card { border-color: #E5E7EB; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card-header { background: #FAFAFA; font-weight: 600; font-size: 14px; border-bottom-color: #E5E7EB; }
.card-footer { background: #FAFAFA; border-top-color: #E5E7EB; }

/* ============================
   Section block (collapsible)
   ============================ */
.section-block { border: 1px solid #E5E7EB; border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.section-block-hdr {
    background: #F9FAFB;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #E5E7EB;
    user-select: none;
}
.section-block-body { padding: 20px; background: #fff; }
.section-block-body.collapsed { display: none; }
.section-toggle-icon { transition: transform .2s; }
.section-toggle-icon.rotated { transform: rotate(180deg); }

/* ============================
   Msg type badges
   ============================ */
.badge-sms { background: #E0F2FE !important; color: #0369A1 !important; }
.badge-lms { background: #FEF3C7 !important; color: #92400E !important; }
.badge-mms { background: #EDE9FE !important; color: #5B21B6 !important; }

/* ============================
   Status pills (campaign)
   ============================ */
.pill { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill-완료    { background: #0F766E; color: #fff; }
.pill-발송완료  { background: #0F766E; color: #fff; }
.pill-예약중   { background: #F59E0B; color: #fff; }
.pill-미사용   { background: #E5E7EB; color: #6B7280; }
.pill-사용    { background: #EF4444; color: #fff; }
.pill-사용가능  { background: #EF4444; color: #fff; }
.pill-진행중   { background: #3B82F6; color: #fff; }
.pill-대기    { background: #E5E7EB; color: #6B7280; }
.pill-작성중   { background: #F97316; color: #fff; }
.pill-승인대기  { background: #8B5CF6; color: #fff; }
.pill-발송대기  { background: #3B82F6; color: #fff; }

/* Customer status badges (sales_status) */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-badge.s-접수         { background: #eff6ff; color: #1d4ed8; }
.status-badge.s-가입\(대면\)  { background: #f0fdf4; color: #15803d; }
.status-badge.s-가입불가      { background: #fef2f2; color: #b91c1c; }
.status-badge.s-가입예약      { background: #ecfdf5; color: #047857; }
.status-badge.s-단순문의      { background: #f8fafc; color: #475569; }
.status-badge.s-도입후부재     { background: #fff7ed; color: #c2410c; }
.status-badge.s-병력         { background: #f5f3ff; color: #6d28d9; }
.status-badge.s-부재중        { background: #fff7ed; color: #c2410c; }
.status-badge.s-상담전통화예약  { background: #fef3c7; color: #92400e; }
.status-badge.s-상담중통화예약  { background: #fef3c7; color: #92400e; }
.status-badge.s-상담후부재     { background: #fff7ed; color: #c2410c; }
.status-badge.s-수신거부      { background: #fef2f2; color: #b91c1c; }
.status-badge.s-쌍둥이        { background: #fdf2f8; color: #be185d; }
.status-badge.s-이벤트동의     { background: #f0f9ff; color: #0369a1; }
.status-badge.s-제안서발송     { background: #eef2ff; color: #4338ca; }
.status-badge.s-중복         { background: #f5f3ff; color: #6d28d9; }
.status-badge.s-타사가입\(거부\) { background: #fef2f2; color: #b91c1c; }
.status-badge.s-터치불가      { background: #f8fafc; color: #475569; }

/* ============================
   Source / category tabs
   ============================ */
.source-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.source-tab {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
    border: 1px solid #E5E7EB; color: #6B7280; text-decoration: none;
    background: #fff; transition: all .15s;
}

.source-tab:hover { border-color: #6366F1; color: #6366F1; text-decoration: none; }

.source-tab.active {
    background: #6366F1; color: #fff; border-color: #6366F1; font-weight: 600;
}

/* ============================
   Phone preview
   ============================ */
.phone-preview-wrap { background: #F3F4F6; border-radius: 12px; padding: 16px; position: sticky; top: 72px; }

.phone-frame {
    background: #111827; border-radius: 36px;
    padding: 14px 12px; max-width: 280px; margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}

.phone-notch { width: 60px; height: 5px; background: #374151; border-radius: 3px; margin: 0 auto 10px; }

.phone-screen { background: #fff; border-radius: 20px; overflow: hidden; min-height: 450px; }

.phone-hdr {
    background: #F3F4F6; padding: 8px 10px;
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600; border-bottom: 1px solid #E5E7EB;
}

.phone-avatar2 { width: 24px; height: 24px; border-radius: 50%; background: #E5E7EB; flex-shrink: 0; }

.phone-body { padding: 10px; min-height: 200px; }

.phone-msg {
    background: #F3F4F6; border-radius: 10px 10px 10px 0;
    padding: 8px 10px; font-size: 11px;
    white-space: pre-wrap; word-break: break-all; line-height: 1.6;
}

.phone-empty {
    display: flex; align-items: center; justify-content: center;
    height: 160px; font-size: 12px; color: #9CA3AF; text-align: center; line-height: 1.6;
}

.phone-legal { font-size: 9px; color: #9CA3AF; margin-top: 6px; line-height: 1.4; }

/* ============================
   Upload drop zone
   ============================ */
.upload-drop {
    border: 2px dashed #D1D5DB; border-radius: 10px;
    padding: 48px 24px; text-align: center; cursor: pointer;
    background: #FAFAFA; transition: all .2s;
}

.upload-drop:hover, .upload-drop.drag-over {
    border-color: #6366F1; background: #EEF0FF;
}

.upload-drop-icon { font-size: 48px; color: var(--brand-orange); }

/* ============================
   Template card grid
   ============================ */
.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.template-card { border: 1px solid #E5E7EB; border-radius: 10px; overflow: hidden; transition: all .15s; cursor: pointer; text-decoration: none !important; display: flex; flex-direction: column; }
.template-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: #C7D2FE; }

.template-card-top { padding: 14px 16px; font-weight: 600; font-size: 14px; color: #1F2937; }
.card-sms .template-card-top { background: #F0F9FF; }
.card-lms .template-card-top { background: #F0FDF4; }
.card-mms .template-card-top { background: #FFF7ED; }

.template-card img { width: 100%; height: 160px; object-fit: cover; display: block; }

.template-card-body { padding: 10px 16px 14px; font-size: 12px; color: #6B7280; line-height: 1.7; flex: 1; }

/* ============================
   Msg type selector (template form)
   ============================ */
.msg-type-group { display: flex; gap: 8px; }

.msg-type-opt { display: none; }

.msg-type-label {
    padding: 9px 16px; border: 2px solid #E5E7EB; border-radius: 8px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    background: #fff; color: #6B7280; transition: all .15s;
    text-align: center; min-width: 90px;
}

.msg-type-label .type-name { display: block; font-size: 13px; }
.msg-type-label .type-sub  { display: block; font-size: 10px; font-weight: 400; margin-top: 2px; }

.msg-type-opt:checked + .msg-type-label {
    border-color: #9CA3AF; background: #F9FAFB; color: #374151;
}

.msg-type-opt.lms:checked + .msg-type-label {
    border-color: #92400E; background: #FEF3C7; color: #92400E;
}

.msg-type-opt.mms:checked + .msg-type-label {
    border-color: #5B21B6; background: #EDE9FE; color: #5B21B6;
}

/* ============================
   Condition builder
   ============================ */
.condition-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.condition-row .form-select, .condition-row .form-control { font-size: 13px; }
.cond-field { min-width: 160px; max-width: 180px; }
.cond-op    { min-width: 110px; max-width: 140px; }
.cond-val-wrap { display: flex; align-items: center; gap: 4px; }
.cond-unit  { font-size: 13px; color: #6B7280; white-space: nowrap; }

.add-cond-btn {
    background: none; border: none; color: #6366F1; font-size: 13px; font-weight: 500;
    cursor: pointer; padding: 4px 0; display: inline-flex; align-items: center; gap: 4px;
}

.add-cond-btn:hover { text-decoration: underline; }

/* ============================
   Target type tabs (campaign form)
   ============================ */
.target-tabs { display: flex; gap: 8px; }

.target-tab-btn {
    padding: 9px 16px; border: 1px solid #E5E7EB; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer; background: #F9FAFB;
    color: #6B7280; transition: all .15s; text-align: center; min-width: 110px;
    font-family: inherit;
}

.target-tab-btn .tab-main { display: block; }
.target-tab-btn .tab-sub  { display: block; font-size: 10px; margin-top: 2px; color: #9CA3AF; }

.target-tab-btn.active {
    background: #EEF0FF; border-color: #6366F1; color: #6366F1; font-weight: 600;
}

.target-tab-btn.active .tab-sub { color: #6366F1; opacity: .7; }

/* ============================
   Week badge
   ============================ */
.week-badge {
    background: #F5F3FF; color: #7C3AED; border: 1px solid #E9D5FF;
    padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
}

/* ============================
   Inbound status select
   ============================ */
.inbound-status {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.is-신규   { background: #EFF6FF; color: #1D4ED8; }
.is-처리중  { background: #FEF3C7; color: #92400E; }
.is-완료   { background: #F0FDF4; color: #15803D; }
.is-보류   { background: #F3F4F6; color: #6B7280; }

/* ============================
   Login page
   ============================ */
.login-bg {
    background: #FBBF4A;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.login-brand { font-size: 34px; font-weight: 800; color: var(--brand-orange); letter-spacing: -.5px; }
.login-brand-sub { font-size: 13px; color: #9CA3AF; margin-top: 4px; font-weight: 500; }
.login-brand-sub .m { color: var(--brand-orange); font-weight: 800; }

/* ============================
   Table tweaks
   ============================ */
.table th { font-size: 12px; font-weight: 600; color: #6B7280; background: #F9FAFB; white-space: nowrap; }
.table td { vertical-align: middle; font-size: 13px; }
.table-hover tbody tr:hover td { background: #FAFAFA; }

/* Row number */
.row-num { color: #9CA3AF; font-size: 12px; }

/* Number cell right-align */
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================
   Spinner
   ============================ */
.my-spinner {
    width: 36px; height: 36px;
    border: 3px solid #E5E7EB;
    border-top-color: #6366F1;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================
   Source badge (list table cell)
   ============================ */
.source-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    white-space: nowrap;
}

/* ============================
   Detail form info row
   ============================ */
.info-row { display: flex; align-items: center; padding: 9px 0; border-bottom: 1px solid #F3F4F6; font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-label { width: 120px; min-width: 120px; font-weight: 600; color: #6B7280; font-size: 12px; }
.info-value { flex: 1; color: #1F2937; }

/* ============================
   Dashboard stat cards
   (구 style.css 의 --primary 등 변수가 gmms.css 에 없어 무스타일이던 것을
   현재 팔레트 기준으로 새로 정의)
   ============================ */
.stat-card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px; border-left: 4px solid transparent;
}
.dash-stat-card { min-height: 105.5px; }
.stat-card .stat-icon { font-size: 28px; line-height: 1; }
.stat-card .stat-num   { font-size: 24px; font-weight: 800; color: #1F2937; line-height: 1.2; margin-top: 8px; }
.stat-card .stat-label { font-size: 14px; color: #6B7280; }
.stat-card-group { display: flex; gap: 60px; width: 100%; }
.stat-card-group .stat-mini { text-align: center; min-width: 0; }
.stat-card-group .stat-mini .stat-mini-num   { font-size: 20px; font-weight: 800; color: #1F2937; line-height: 1.2; }
.stat-card-group .stat-mini .stat-mini-label { font-size: 11px; color: #6B7280; margin-top: 2px; white-space: nowrap; }
.stat-blue    { border-left-color: #6366F1; }
.stat-green   { border-left-color: #16A34A; }
.stat-orange  { border-left-color: var(--brand-orange); }
.stat-purple  { border-left-color: #7C3AED; }
.stat-red     { border-left-color: #DC2626; }
.stat-teal    { border-left-color: #0F766E; }

/* Dashboard action alert */
.action-alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 10px;
    background: #FFF7ED; border: 1px solid #FDBA74; color: #9A3412;
    font-size: 13px; font-weight: 600; text-decoration: none;
}
.action-alert:hover { background: #FFEDD5; color: #9A3412; }
.action-alert .count { font-size: 16px; font-weight: 800; }

/* Funnel */
.funnel-wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.funnel-step { flex: 1; text-align: center; }
.funnel-step .funnel-num   { font-size: 26px; font-weight: 800; color: #1F2937; }
.funnel-step .funnel-label { font-size: 12px; color: #6B7280; margin-top: 4px; }
.funnel-arrow { flex: 0 0 auto; text-align: center; color: #9CA3AF; }
.funnel-arrow .funnel-rate { display: block; font-size: 12px; font-weight: 700; color: #6366F1; margin-top: 2px; }

/* Horizontal bar chart (e.g. 영업상태 분포) */
.chart-hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chart-hbar-name {
    width: 110px; min-width: 110px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; color: #6B7280;
}
.chart-hbar-track { flex: 1; height: 20px; background: #F3F4F6; border-radius: 4px; }
.chart-hbar-fill {
    height: 20px; max-height: 20px; background: #6366F1;
    border-radius: 0 4px 4px 0; transition: filter .1s;
}
.chart-hbar-row:hover .chart-hbar-fill { filter: brightness(1.12); }
.chart-hbar-value { width: 56px; text-align: right; color: #6B7280; font-variant-numeric: tabular-nums; }

.chart-tooltip {
    position: fixed; background: #1F2937; color: #fff; padding: 6px 10px;
    border-radius: 6px; font-size: 12px; pointer-events: none; z-index: 2000;
    white-space: nowrap;
}

/* 반응형 미적용 - 데스크탑 전용 */
