:root {
  --navy:    #0D1B2A;
  --blue:    #1A5276;
  --mid:     #2471A3;
  --sky:     #3498DB;
  --light:   #EBF5FB;
  --teal:    #0E9488;
  --teal-l:  #CCFBF1;
  --green:   #16A34A;
  --green-l: #DCFCE7;
  --amber:   #D97706;
  --amber-l: #FEF3C7;
  --red:     #DC2626;
  --red-l:   #FEE2E2;
  --purple:  #7C3AED;
  --purple-l:#EDE9FE;
  --gray-l:  #F7F9FC;
  --gray-1:  #F1F4F8;
  --gray-2:  #E2E8F0;
  --gray-3:  #CBD5E1;
  --gray-4:  #94A3B8;
  --gray-5:  #64748B;
  --gray-7:  #334155;
  --white:   #FFFFFF;
  --sidebar-w: 256px;
  --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; }

body {
  font-family: var(--font-b);
  background: var(--gray-l);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 200;
}

.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-decoration: none;
}

.sb-logo-box {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sb-logo-text { font-family: var(--font-d); font-size: 17px; font-weight: 700; color: #fff; }

.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sb-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sky), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}

.sb-name { font-size: 13px; font-weight: 700; color: #fff; }
.sb-plan { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 1px; }

.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; color: rgba(255,255,255,.25);
  padding: 12px 20px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; margin: 1px 8px;
  border-radius: 9px; cursor: pointer; text-decoration: none;
  color: rgba(255,255,255,.5); font-size: 13px; font-weight: 500;
  transition: all .18s;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.8); }
.nav-item.active { background: rgba(52,152,219,.2); color: #fff; font-weight: 700; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Main ── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

.header {
  height: 60px; background: var(--white);
  border-bottom: 1px solid var(--gray-2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; box-shadow: 0 1px 4px rgba(13,27,42,.06);
  position: sticky; top: 0; z-index: 100;
}

.header-title { font-family: var(--font-d); font-size: 17px; font-weight: 700; color: var(--navy); }
.header-sub { font-size: 13px; color: var(--gray-4); }

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

/* 통계 스트립 */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card {
  background: var(--white); border: 1px solid var(--gray-2);
  border-radius: 14px; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 1px 4px rgba(13,27,42,.05); transition: all .2s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(13,27,42,.1); transform: translateY(-1px); }
.sc-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.sc-v { font-family: var(--font-d); font-size: 24px; font-weight: 700; color: var(--navy); }
.sc-l { font-size: 12px; color: var(--gray-4); margin-top: 2px; }

/* 필터 바 */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-group { display: flex; gap: 4px; background: var(--white); border: 1px solid var(--gray-2); border-radius: 11px; padding: 3px; box-shadow: 0 1px 4px rgba(13,27,42,.05); }
.tab { padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--gray-5); cursor: pointer; transition: all .18s; border: none; background: transparent; font-family: var(--font-b); }
.tab.active { background: var(--blue); color: #fff; }
.filter-select { padding: 8px 12px; border: 1px solid var(--gray-2); border-radius: 9px; background: var(--white); font-family: var(--font-b); font-size: 13px; color: var(--gray-7); cursor: pointer; }
.search-input { padding: 8px 14px; border: 1.5px solid var(--gray-2); border-radius: 9px; font-family: var(--font-b); font-size: 13px; color: var(--navy); background: var(--white); transition: border-color .18s; min-width: 200px; }
.search-input:focus { outline: none; border-color: var(--sky); }

/* 이력 카드 */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.h-card { background: var(--white); border: 1.5px solid var(--gray-2); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 4px rgba(13,27,42,.05); transition: all .2s; cursor: pointer; }
.h-card:hover { border-color: var(--gray-3); box-shadow: 0 4px 16px rgba(13,27,42,.1); transform: translateY(-1px); }
.h-card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; }
.hc-field-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0; }
.hc-info { flex: 1; min-width: 0; }
.hc-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hc-chip { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 100px; }
.hc-date { font-size: 12px; color: var(--gray-4); }
.hc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.hc-status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 100px; }
.hc-rating { font-size: 14px; color: var(--amber); }
.h-expand-toggle { background: none; border: none; font-size: 18px; color: var(--gray-4); cursor: pointer; transition: transform .2s; }

.h-card-body { padding: 0 20px 16px; border-top: 1px solid var(--gray-1); display: none; }
.h-card.expanded .h-card-body { display: block; }
.h-card.expanded { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(52,152,219,.08); }
.h-card.expanded .h-expand-toggle { transform: rotate(180deg); }

.hb-expert { display: flex; align-items: center; gap: 10px; background: var(--gray-l); border-radius: 11px; padding: 12px 14px; margin-top: 12px; }
.hbe-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--light); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.hbe-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.hbe-field { font-size: 12px; color: var(--gray-5); margin-top: 2px; }
.hb-actions { display: flex; gap: 8px; margin-top: 10px; }
.hb-btn { padding: 9px 16px; border-radius: 9px; font-family: var(--font-b); font-size: 13px; font-weight: 700; cursor: pointer; transition: all .18s; text-decoration: none; border: none; text-align: center; }
.hb-btn.outline { border: 1.5px solid var(--blue); background: var(--white); color: var(--blue); }
.hb-btn.gray { background: var(--gray-1); color: var(--gray-7); }
.hb-btn.green { background: var(--green); color: #fff; }

@keyframes fadeUpHistory { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.h-card { animation: fadeUpHistory .35s ease both; }

#toastEl {
  position: fixed;
  bottom: 24px;
  left: calc(var(--sidebar-w) + 24px);
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  transform: translateY(70px);
  opacity: 0;
  transition: all .35s cubic-bezier(.34,1.56,.64,1);
  z-index: 600;
}

@media(max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  #toastEl { left: 24px; }
}
@media(max-width: 800px) {
  .stat-strip { grid-template-columns: 1fr 1fr; }
}
