:root {
  --navy:     #0D1B2A;
  --blue:     #1A5276;
  --mid:      #2471A3;
  --sky:      #3498DB;
  --light:    #D6EAF8;
  --teal:     #0E6655;
  --teal-l:   #D1F2EB;
  --amber:    #D4A017;
  --amber-l:  #FEF9E7;
  --green:    #1E8449;
  --green-l:  #D5F5E3;
  --red:      #C0392B;
  --red-l:    #FADBD8;
  --orange:   #D35400;
  --orange-l: #FDEBD0;
  --purple:   #6C3483;
  --purple-l: #E8DAEF;
  --white:    #FFFFFF;
  --bg:       #F0F4F8;
  --card:     #FFFFFF;
  --g100:     #EEF1F4;
  --g200:     #DDE3EA;
  --g300:     #BDC8D2;
  --g400:     #8FA0AE;
  --g600:     #4A5568;
  --g700:     #2D3748;
  --sidebar-w: 256px;
  --header-h:  64px;
  --r:         14px;
  --r-sm:      10px;
  --shadow:    0 2px 12px rgba(13,27,42,.08);
  --shadow-md: 0 8px 32px rgba(13,27,42,.13);
  --font-d:    'Gmarket Sans', 'Noto Sans KR', sans-serif;
  --font-b:    'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--g700);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 3px; }

/* ════ 사이드바 ════ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .3s ease;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-decoration: none;
}
.logo-box {
  width: 36px; height: 36px; background: var(--blue);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-d); font-size: 17px; font-weight: 700;
  color: var(--white); line-height: 1.2;
}
.logo-plan { font-size: 11px; color: rgba(255,255,255,.4); font-weight: 400; }

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 12px;
}
.user-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--sky), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 700; color: var(--white); }
.user-biz  { font-size: 12px; color: rgba(255,255,255,.45); margin-top: 2px; }
.user-badge {
  margin-left: auto; background: var(--sky);
  color: var(--white); font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 100px; flex-shrink: 0;
}

.sidebar-quota {
  margin: 12px 16px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-sm); padding: 12px 14px;
}
.quota-label { font-size: 11px; color: rgba(255,255,255,.45); margin-bottom: 8px; }
.quota-bar-wrap { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.quota-bar { height: 100%; background: linear-gradient(90deg, var(--sky), #48C9B0); border-radius: 3px; width: 0; transition: width .8s ease; }
.quota-nums { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.55); }
.quota-nums strong { color: var(--white); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  color: rgba(255,255,255,.3); text-transform: uppercase;
  padding: 12px 20px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; cursor: pointer; text-decoration: none;
  transition: background .18s;
  color: rgba(255,255,255,.55); font-size: 14px; font-weight: 500;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.nav-item.active { background: rgba(52,152,219,.18); color: var(--white); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--sky); border-radius: 0 2px 2px 0;
}
.nav-icon { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red); color: var(--white);
  font-size: 11px; font-weight: 700; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
}

.sidebar-bottom { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.upgrade-card { background: linear-gradient(135deg, var(--blue), var(--mid)); border-radius: var(--r-sm); padding: 14px; text-align: center; }
.upgrade-card p { font-size: 12px; color: rgba(255,255,255,.75); margin-bottom: 10px; line-height: 1.5; }
.upgrade-card p strong { color: var(--white); }
.upgrade-btn {
  display: block; background: var(--white); color: var(--blue);
  font-size: 12px; font-weight: 700; padding: 8px;
  border-radius: 8px; text-decoration: none; text-align: center;
  transition: all .2s;
}
.upgrade-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }

/* ════ 메인 레이아웃 ════ */
.main-wrap { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--g100);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.mobile-toggle { display: none; cursor: pointer; font-size: 20px; color: var(--g600); padding: 4px; border: none; background: none; }
.header-greeting strong { font-family: var(--font-d); font-size: 16px; color: var(--navy); }
.header-greeting span { font-size: 13px; color: var(--g400); }
.header-date { font-size: 13px; color: var(--g400); margin-top: 1px; }

.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px;
  background: var(--g100); border: none; cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.header-btn:hover { background: var(--g200); }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid var(--white); }
.header-quick-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--blue); color: var(--white);
  border: none; cursor: pointer; font-family: var(--font-b);
  font-size: 13px; font-weight: 700;
  padding: 9px 16px; border-radius: 10px;
  transition: all .22s cubic-bezier(.34,1.56,.64,1);
  text-decoration: none;
}
.header-quick-btn:hover { background: var(--mid); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26,82,118,.3); }

.main-content { padding: 24px 28px; flex: 1; }

/* 환영 배너 */
.welcome-banner {
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a5c 60%, #1e4d7a 100%);
  border-radius: 20px; padding: 28px 32px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; position: relative; overflow: hidden;
}
.welcome-banner::before { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(52,152,219,.2) 0%, transparent 70%); }
.welcome-banner::after { content: ''; position: absolute; left: 40%; bottom: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(72,201,176,.12) 0%, transparent 70%); }
.wb-left { position: relative; z-index: 1; }
.wb-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.8); font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 100px; margin-bottom: 12px;
}
.wb-title { font-family: var(--font-d); font-size: 22px; font-weight: 700; color: var(--white); margin-bottom: 8px; line-height: 1.3; }
.wb-sub { font-size: 14px; color: rgba(255,255,255,.6); }
.wb-right { display: flex; gap: 12px; position: relative; z-index: 1; }
.wb-stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 14px 18px; text-align: center; min-width: 90px; }
.wb-stat-num { font-family: var(--font-d); font-size: 24px; font-weight: 700; color: var(--white); line-height: 1; }
.wb-stat-label { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 4px; }

/* KPI 그리드 */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--card); border-radius: var(--r);
  padding: 20px; border: 1px solid var(--g100);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-card::after { content: ''; position: absolute; top: 0; right: 0; width: 80px; height: 80px; border-radius: 0 var(--r) 0 80px; opacity: .07; }
.kpi-card.c-blue::after  { background: var(--blue); }
.kpi-card.c-teal::after  { background: var(--teal); }
.kpi-card.c-amber::after { background: var(--amber); }
.kpi-card.c-green::after { background: var(--green); }

.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.kpi-card.c-blue  .kpi-icon { background: var(--light); }
.kpi-card.c-teal  .kpi-icon { background: var(--teal-l); }
.kpi-card.c-amber .kpi-icon { background: var(--amber-l); }
.kpi-card.c-green .kpi-icon { background: var(--green-l); }

.kpi-trend { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 100px; display: flex; align-items: center; gap: 3px; }
.kpi-trend.up   { background: var(--green-l); color: var(--green); }
.kpi-trend.down { background: var(--red-l); color: var(--red); }
.kpi-trend.same { background: var(--g100); color: var(--g400); }
.kpi-value { font-family: var(--font-d); font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1; margin-bottom: 6px; }
.kpi-label { font-size: 13px; color: var(--g400); }

/* 중단 그리드 */
.mid-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; margin-bottom: 20px; }

.card { background: var(--card); border-radius: var(--r); border: 1px solid var(--g100); box-shadow: var(--shadow); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--g100); }
.card-title { font-family: var(--font-d); font-size: 15px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.card-title-icon { font-size: 16px; }
.card-more { font-size: 13px; color: var(--sky); font-weight: 600; text-decoration: none; display: flex; align-items: center; gap: 4px; transition: gap .2s; }
.card-more:hover { gap: 8px; }

.consult-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--g100); transition: background .18s; cursor: pointer; }
.consult-item:last-child { border: none; }
.consult-item:hover { background: var(--bg); }
.consult-field-icon { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.consult-info { flex: 1; min-width: 0; }
.consult-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.consult-meta  { font-size: 12px; color: var(--g400); }
.consult-right { text-align: right; flex-shrink: 0; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 100px; white-space: nowrap; }
.status-chip.waiting  { background: var(--amber-l); color: var(--amber); }
.status-chip.matched  { background: var(--light); color: var(--blue); }
.status-chip.chatting { background: var(--green-l); color: var(--green); }
.status-chip.done     { background: var(--g100); color: var(--g400); }
.status-chip.urgent   { background: var(--red-l); color: var(--red); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.consult-time { font-size: 11px; color: var(--g300); margin-top: 4px; }

.quick-ask { background: var(--card); border-radius: var(--r); border: 1px solid var(--g100); box-shadow: var(--shadow); }
.quick-ask-header { padding: 18px 20px; border-bottom: 1px solid var(--g100); }
.quick-ask-title { font-family: var(--font-d); font-size: 15px; font-weight: 700; color: var(--navy); }
.quick-ask-sub   { font-size: 12px; color: var(--g400); margin-top: 3px; }

.field-pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--g100); }
.field-pill { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 100px; border: 1.5px solid var(--g200); background: var(--white); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; }
.field-pill:hover, .field-pill.selected { border-color: var(--blue); background: var(--light); color: var(--blue); }

.ask-textarea-wrap { padding: 14px 20px; }
.ask-textarea { width: 100%; border: 1.5px solid var(--g200); border-radius: 10px; padding: 12px 14px; font-family: var(--font-b); font-size: 14px; color: var(--navy); resize: none; height: 90px; transition: border-color .2s; background: var(--bg); }
.ask-textarea:focus { outline: none; border-color: var(--sky); background: var(--white); }

.ask-footer { padding: 0 20px 16px; display: flex; align-items: center; justify-content: space-between; }
.ask-attach { font-size: 12px; color: var(--g400); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ask-submit { background: var(--blue); color: var(--white); border: none; border-radius: 10px; padding: 10px 20px; font-family: var(--font-b); font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all .22s cubic-bezier(.34,1.56,.64,1); }

.bot-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.expert-item { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--g100); transition: background .18s; cursor: pointer; }
.expert-avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; background: var(--light); }
.expert-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.expert-rating { font-size: 13px; font-weight: 700; color: var(--navy); }
.expert-online { font-size: 11px; color: var(--green); font-weight: 600; }

.notif-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--g100); transition: background .18s; cursor: pointer; }
.notif-item.unread { background: #F0F7FF; }
.notif-icon-wrap { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.unread-dot { width: 7px; height: 7px; background: var(--sky); border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

.tip-item { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--g100); align-items: flex-start; }
.tip-num { width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0; background: var(--light); color: var(--blue); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }

.sub-card { background: linear-gradient(135deg, var(--blue), var(--mid)); border-radius: var(--r); padding: 20px; color: var(--white); margin: 16px 20px; }
.sub-plan-name { font-family: var(--font-d); font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.sub-bar-wrap { height: 8px; background: rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.sub-bar { height: 100%; background: rgba(255,255,255,.9); border-radius: 4px; }
.sub-action-btn { flex: 1; text-align: center; padding: 9px; border-radius: 9px; font-size: 12px; font-weight: 700; text-decoration: none; transition: all .2s; }
.sub-action-btn.outline { border: 1.5px solid rgba(255,255,255,.4); color: var(--white); }
.sub-action-btn.solid { background: var(--white); color: var(--blue); }

/* 모달 */
.modal-overlay { position: fixed; inset: 0; background: rgba(13,27,42,.5); backdrop-filter: blur(4px); z-index: 500; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .25s; }
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal { background: var(--white); border-radius: 20px; width: 520px; max-width: 94vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(13,27,42,.25); transform: scale(.95) translateY(16px); transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-header { padding: 24px 24px 16px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--g100); }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: var(--g100); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-body { padding: 20px 24px; }
.modal-fields-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.modal-field-btn { padding: 10px 8px; border-radius: 10px; border: 1.5px solid var(--g200); background: var(--white); font-family: var(--font-b); font-size: 13px; cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all .2s; }
.modal-field-btn.active { border-color: var(--blue); background: var(--light); color: var(--blue); }
.modal-textarea { width: 100%; border: 1.5px solid var(--g200); border-radius: 10px; padding: 12px 14px; font-family: var(--font-b); font-size: 14px; color: var(--navy); resize: none; height: 110px; background: var(--bg); }
.urgency-btns { display: flex; gap: 8px; }
.urgency-btn { flex: 1; padding: 10px; border-radius: 10px; border: 1.5px solid var(--g200); background: var(--white); font-family: var(--font-b); font-size: 13px; cursor: pointer; transition: all .2s; }
.urgency-btn.active-normal { border-color: var(--blue); background: var(--light); color: var(--blue); font-weight: 700; }
.urgency-btn.active-urgent { border-color: var(--red); background: var(--red-l); color: var(--red); font-weight: 700; }
.attach-zone { border: 2px dashed var(--g200); border-radius: 10px; padding: 18px; text-align: center; cursor: pointer; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--g100); display: flex; gap: 10px; }
.modal-submit { flex: 2; padding: 13px; border-radius: 10px; border: none; background: var(--blue); color: var(--white); font-family: var(--font-b); font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* 토스트 */
.toast { position: fixed; bottom: 24px; left: calc(var(--sidebar-w) + 28px); background: var(--navy); color: var(--white); padding: 14px 20px; border-radius: 12px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-md); transform: translateY(80px); opacity: 0; transition: all .35s cubic-bezier(.34,1.56,.64,1); z-index: 600; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .bot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .sidebar { transform: translateX(-100%); } .sidebar.open { transform: translateX(0); } .main-wrap { margin-left: 0; } .mobile-toggle { display: flex; } .mid-grid { grid-template-columns: 1fr; } .toast { left: 16px; right: 16px; } }

@keyframes fadeSlideDashboard { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.kpi-card, .welcome-banner, .card { animation: fadeSlideDashboard .4s ease both; }
