/* ══════════════════════════════════════════
   Simple.Lab — Dashboard v4
   ══════════════════════════════════════════ */

.db-wrap { padding: 24px 28px 32px; max-width: 1440px; margin: 0 auto; }
.db-content { opacity: 0; transition: opacity .35s ease; }
.db-content.revealed { opacity: 1; }

/* ── 스켈레톤 ── */
.db-skel-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 20px; }
.db-skel-charts { display: grid; grid-template-columns: 1fr; gap: 14px; }
.skel-kpi { height: 110px; border-radius: 12px; background: linear-gradient(90deg,#f3f4f6 25%,#e5e7eb 50%,#f3f4f6 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg,#f3f4f6 25%,#e5e7eb 50%,#f3f4f6 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── 날짜 헤더 ── */
.db-date-header {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.db-date-today { font-size: 15px; font-weight: 700; color: #111827; letter-spacing: -.02em; }
.db-date-period { font-size: 12px; font-weight: 500; color: #9ca3af; padding: 2px 10px; border-radius: 6px; background: #f3f4f6; }
.db-date-refresh { font-size: 11px; color: #d1d5db; margin-left: auto; }

/* ═══ KPI ═══ */
.db-kpi-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 20px; }
.db-kpi {
    background: #fff; border: 1px solid #f0f1f3; border-radius: 12px;
    padding: 18px 20px 14px; transition: box-shadow .2s, border-color .2s;
}
.db-kpi:hover { box-shadow: 0 4px 16px rgba(0,0,0,.05); border-color: #e5e7eb; }
.db-kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.db-kpi-icon {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
}
.db-kpi-icon-pink   { background: #fdf2f8; color: #e6007e; }
.db-kpi-icon-green  { background: #ecfdf5; color: #10b981; }
.db-kpi-icon-violet { background: #f5f3ff; color: #7c3aed; }
.db-kpi-icon-amber  { background: #fffbeb; color: #f59e0b; }
.db-kpi-label { font-size: 12px; font-weight: 600; color: #9ca3af; letter-spacing: -.01em; }
.db-kpi-body { display: flex; align-items: baseline; gap: 4px; margin-bottom: 6px; }
.db-kpi-value { font-size: 28px; font-weight: 800; color: #111827; line-height: 1.1; letter-spacing: -.03em; }
.db-kpi-unit { font-size: 13px; font-weight: 500; color: #9ca3af; }
.db-kpi-delta { font-size: 11.5px; font-weight: 700; margin-left: 4px; padding: 1px 6px; border-radius: 6px; }
.db-delta-up   { color: #059669; background: #ecfdf5; }
.db-delta-down { color: #dc2626; background: #fef2f2; }
.db-kpi-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #b0b5bf; }
.db-kpi-sub strong { font-weight: 700; color: #6b7280; }
.db-progress-bar { flex: 1; height: 5px; background: #f3f4f6; border-radius: 3px; overflow: hidden; max-width: 80px; }
.db-progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#10b981,#34d399); transition: width .6s ease; }

/* ═══ 카드 공통 ═══ */
.db-card {
    background: #fff; border: 1px solid #f0f1f3; border-radius: 12px;
    padding: 20px; transition: box-shadow .2s; min-width: 0;
}
.db-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.04); }
.db-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.db-card-title { font-size: 14px; font-weight: 700; color: #111827; }
.db-card-desc { font-size: 11.5px; color: #9ca3af; margin-top: 2px; line-height: 1.45; }

/* ═══ 접수 추이 (드릴다운) ═══ */
.db-card-trend { margin-bottom: 20px; }

.db-drill-back {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid #e5e7eb; background: #fff;
    cursor: pointer; transition: all .15s; flex-shrink: 0;
    color: #6b7280;
}
.db-drill-back:hover { background: #f9fafb; border-color: #d1d5db; color: #374151; }

.db-drill-hint {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600; color: #9ca3af;
    background: #f9fafb; padding: 4px 11px;
    border-radius: 20px; white-space: nowrap;
    border: 1px solid #f0f1f3;
    animation: hintPulse 2s ease-in-out 1s 2;
}
.db-drill-hint svg { color: #e6007e; flex-shrink: 0; }
@keyframes hintPulse {
    0%, 100% { border-color: #f0f1f3; background: #f9fafb; }
    50% { border-color: rgba(230,0,126,.2); background: rgba(230,0,126,.03); }
}

.db-drill-badge {
    display: inline-flex; align-items: center;
    font-size: 12px; font-weight: 700; color: #e6007e;
    background: rgba(230,0,126,.06); padding: 3px 10px;
    border-radius: 6px; white-space: nowrap;
}

.db-drill-loading {
    position: absolute; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.7); border-radius: 8px;
}
.db-drill-spinner {
    width: 24px; height: 24px; border-radius: 50%;
    border: 3px solid #f3f4f6; border-top-color: #e6007e;
    animation: drillSpin .6s linear infinite;
}
@keyframes drillSpin { to { transform: rotate(360deg); } }

/* ═══ 섹션 그리드 ═══ */
.db-section-row { display: grid; gap: 14px; margin-bottom: 20px; }
.db-section-bottom { grid-template-columns: 1fr 1fr; }

.db-chart-wrap { position: relative; overflow: hidden; }
.db-chart-radar-wrap { position: relative; height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* ── 레이더 범례 ── */
.db-radar-legend { display: flex; justify-content: center; gap: 18px; margin-top: 8px; }
.db-radar-leg { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #6b7280; }
.db-rleg-dot { width: 10px; height: 10px; border-radius: 3px; }
.db-rleg-this { background: rgba(230,0,126,.7); }
.db-rleg-last { background: rgba(156,163,175,.4); }

/* ═══ 등급 현황 카드 ═══ */
.db-grade-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.db-gb-row { display: flex; align-items: center; gap: 8px; }
.db-gb-badge {
    width: 26px; height: 26px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.db-gb-s { background: rgba(230,0,126,.1);  color: #e6007e; }
.db-gb-a { background: rgba(245,158,11,.1); color: #d97706; }
.db-gb-b { background: rgba(59,130,246,.1); color: #2563eb; }
.db-gb-c { background: rgba(107,114,128,.08); color: #6b7280; }
.db-gb-d { background: rgba(209,213,219,.15); color: #9ca3af; }

.db-gb-track {
    flex: 1; height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden;
}
.db-gb-fill {
    height: 100%; border-radius: 4px;
    transition: width .6s cubic-bezier(.25,.8,.25,1);
    min-width: 2px;
}
.db-gb-fill-s { background: linear-gradient(90deg, #e6007e, #ff6b9d); }
.db-gb-fill-a { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.db-gb-fill-b { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.db-gb-fill-c { background: #c4c8cf; }
.db-gb-fill-d { background: #e0e2e6; }

.db-gb-count { font-size: 11.5px; font-weight: 600; color: #6b7280; width: 38px; text-align: right; flex-shrink: 0; }

/* S+A 비율 */
.db-sa-wrap {
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}
.db-sa-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.db-sa-label { font-size: 12.5px; font-weight: 700; color: #374151; }
.db-sa-delta { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.db-sa-bar {
    height: 10px; background: #f3f4f6; border-radius: 5px; overflow: hidden;
    margin-bottom: 6px;
}
.db-sa-fill {
    height: 100%; border-radius: 5px;
    background: linear-gradient(90deg, #e6007e, #ff6b9d);
    transition: width .7s ease;
}
.db-sa-footer {
    display: flex; justify-content: space-between;
    font-size: 11px; color: #9ca3af;
}
.db-sa-footer strong { font-weight: 700; color: #374151; }

/* ═══ 히트맵 ═══ */
.db-card-heatmap { margin-bottom: 20px; }
.db-hm-scroll { overflow-x: auto; overflow-y: hidden; }
.db-hm-grid { display: grid; gap: 3px; min-width: 500px; }
.db-hm-corner { }
.db-hm-month { font-size: 10.5px; font-weight: 600; color: #9ca3af; text-align: center; padding: 0 0 6px; }
.db-hm-type {
    font-size: 11.5px; font-weight: 500; color: #4b5563;
    display: flex; align-items: center; padding-right: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 32px;
}
.db-hm-cell {
    height: 32px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    cursor: default; position: relative;
    transition: box-shadow .1s;
}
.db-hm-cell:hover { box-shadow: 0 0 0 2px #e6007e inset; z-index: 2; }
.db-hm-val { font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.2); pointer-events: none; }
.db-hm-legend { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.db-hm-leg-box { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.04); }
.db-hm-leg-label { font-size: 10px; color: #9ca3af; margin: 0 2px; }
.db-hm-tooltip {
    position: fixed; z-index: 999; background: #1f2937; color: #fff;
    font-size: 11.5px; line-height: 1.5; padding: 8px 12px;
    border-radius: 8px; pointer-events: none; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

/* ═══ 고득점 제안 ═══ */
.db-card-top { margin-bottom: 0; }
.db-link-more { font-size: 12px; font-weight: 600; color: #e6007e; text-decoration: none; white-space: nowrap; }
.db-link-more:hover { text-decoration: underline; }
.db-top-list { display: flex; flex-direction: column; }
.db-top-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 8px; border-bottom: 1px solid #f5f5f7;
    text-decoration: none; color: inherit; transition: background .12s; cursor: pointer;
}
.db-top-row:last-child { border-bottom: none; }
.db-top-row:hover { background: #fafafe; }
.db-top-rank {
    width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; background: #f3f4f6;
    font-size: 11px; font-weight: 700; color: #6b7280; flex-shrink: 0;
}
.db-top-grade {
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.db-tg-s { background: rgba(230,0,126,.1); color: #e6007e; }
.db-tg-a { background: rgba(245,158,11,.1); color: #d97706; }
.db-tg-b { background: rgba(59,130,246,.1); color: #2563eb; }
.db-tg-c { background: rgba(107,114,128,.08); color: #6b7280; }
.db-tg-d { background: rgba(209,213,219,.15); color: #9ca3af; }
.db-top-score { font-size: 12px; font-weight: 700; color: #374151; width: 44px; text-align: right; flex-shrink: 0; }
.db-top-body { flex: 1; min-width: 0; }
.db-top-tags { display: flex; gap: 4px; margin-bottom: 3px; flex-wrap: wrap; }
.db-top-tag { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: rgba(230,0,126,.06); color: #e6007e; }
.db-top-tag-muted { background: #f3f4f6; color: #6b7280; }
.db-top-text {
    font-size: 12.5px; color: #4b5563; line-height: 1.55;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.db-top-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; min-width: 50px; }
.db-top-meta span { font-size: 10.5px; color: #b0b5bf; }

.db-empty { text-align: center; font-size: 12px; color: #d1d5db; padding: 16px 0; }

/* ═══ 반응형 ═══ */
@media (max-width: 1024px) {
    .db-kpi-grid { grid-template-columns: repeat(2,1fr); }
    .db-section-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .db-wrap { padding: 16px 14px; }
    .db-kpi-grid { grid-template-columns: 1fr; }
    .db-skel-kpis { grid-template-columns: 1fr; }
    .db-top-score { display: none; }
    .db-date-header { gap: 6px; }
    .db-date-today { font-size: 13px; }
}
