/* 첫 화면(대시보드) 스타일 (docs/dashboard.md). 색·글자 크기는 auth.css 의 --auth-* 와 theme.css 의 --fs-* 를 따른다.
   차트 안의 색은 Services/DashboardCharts.cs 에 있다 (파랑 #2a78d6 = 이 화면의 기본 데이터 색) */

.dash {
    --dash-border: #e3e7ee;
    --dash-blue: #2a78d6;
    --dash-good: #006300;
    --dash-bad: #d03b3b;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 기간을 바꾸거나 새로 불러오는 동안은 이전 값을 흐리게 둔다 (자리가 움직이지 않게) */
.dash.is-stale .dash-tiles,
.dash.is-stale .dash-row,
.dash.is-stale .dash-landing {
    opacity: .55;
}

.dash .dash-tiles,
.dash .dash-row,
.dash .dash-landing {
    transition: opacity .15s;
}

/* ---- 위쪽: 기간 선택 ---- */
.dash-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-period {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
}

.dash-period-btn {
    padding: 3px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--auth-text-sub);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
}

.dash-period-btn:hover {
    background: #f6f8fa;
}

.dash-period-btn.is-active,
.dash-period-btn.is-active:hover {
    background: var(--auth-primary);
    color: #fff;
}

.dash-refresh {
    width: 30px;
    height: 30px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: #fff;
    color: var(--auth-text-sub);
    cursor: pointer;
}

.dash-refresh:hover {
    border-color: var(--auth-primary);
    color: var(--auth-primary);
}

.dash-period-btn:focus-visible,
.dash-refresh:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 1px;
}

/* ---- 공지 ---- */
.dash-notice {
    display: flex;
    gap: 10px;
    padding: 9px 14px;
    background: #fff;
    border: 1px solid var(--dash-border);
    border-left: 3px solid var(--auth-primary);
    border-radius: 10px;
    font-size: var(--fs-sm);
    color: var(--auth-text);
}

.dash-notice > i {
    margin-top: 3px;
    color: var(--auth-primary);
}

.dash-notice-body {
    min-width: 0;
}

.dash-notice summary {
    margin-top: 2px;
    color: var(--auth-text-sub);
    font-size: var(--fs-xs);
    cursor: pointer;
}

.dash-notice p {
    margin: 6px 0 0;
    color: var(--auth-text-sub);
    font-size: var(--fs-xs);
    line-height: 1.6;
}

/* ---- 처리할 일 ---- */
.dash-todo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    font-size: var(--fs-sm);
}

.dash-todo-title {
    margin-right: 4px;
    color: var(--auth-text);
    font-weight: 600;
}

.dash-todo.is-clear {
    color: var(--auth-text-sub);
}

.dash-todo.is-clear i {
    margin-right: 4px;
    color: var(--auth-success);
}

.dash-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid #ffd591;
    border-radius: 999px;
    background: #fff7e6;
    color: #ad4e00;
    font-size: var(--fs-sm);
    text-decoration: none;
}

.dash-chip b {
    font-size: var(--fs-base);
}

.dash-chip:hover {
    background: #ffe7ba;
    color: #ad4e00;
}

.dash-chip:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 1px;
}

/* ---- 숫자 카드 ---- */
.dash-tiles {
    display: grid;
    grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
    gap: 10px;
}

.dash-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 124px;
    padding: 12px 14px 10px;
    background: #fff;
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.dash-tile.is-hero {
    grid-column: span 2;
}

.dash-tile.is-warn {
    background: #fffbf0;
    border-color: #ffe3a3;
}

/* 이름과 기간은 한 줄에 둔다 (줄이 바뀌면 옆 카드와 큰 숫자의 높이가 어긋난다). 모자라면 기간 쪽을 말줄임 */
.dash-tile-label {
    display: flex;
    align-items: baseline;
    gap: 0 6px;
    min-width: 0;
    color: var(--auth-text-sub);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.dash-tile-note {
    min-width: 0;
    overflow: hidden;
    color: var(--auth-text-sub);
    font-size: var(--fs-xs);
    font-weight: 400;
    text-overflow: ellipsis;
}

.dash-tile-value {
    margin-top: 6px;
    color: var(--auth-text);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
}

.dash-tile.is-hero .dash-tile-value {
    font-size: 48px;
    line-height: 1.1;
}

.dash-tile-unit {
    margin-left: 3px;
    color: var(--auth-text-sub);
    font-size: var(--fs-base);
    font-weight: 500;
}

.dash-tile.is-hero .dash-tile-unit {
    font-size: var(--fs-lg);
}

.dash-tile-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    margin-top: 4px;
    font-size: var(--fs-xs);
    line-height: 18px;
}

.dash-muted {
    color: var(--auth-text-sub);
}

.dash-delta {
    font-weight: 600;
    white-space: nowrap;
}

.dash-delta.is-good {
    color: var(--dash-good);
}

.dash-delta.is-bad {
    color: var(--dash-bad);
}

.dash-delta.is-flat {
    color: var(--auth-text-sub);
}

.dash-tile-skeleton {
    width: 60%;
    height: 36px;
    margin-top: 10px;
}

/* 일별 작은 선 */
.dash-spark {
    position: relative;
    height: 30px;
    margin-top: auto;
}

.dash-tile.is-hero .dash-spark {
    height: 36px;
}

.dash-spark svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.dash-spark-line {
    fill: none;
    stroke: var(--dash-blue);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.dash-spark-area {
    fill: var(--dash-blue);
    opacity: .10;
    stroke: none;
}

.dash-spark-dot {
    position: absolute;
    right: -4px;
    width: 9px;
    height: 9px;
    margin-top: -4.5px;
    border-radius: 50%;
    background: var(--dash-blue);
    box-shadow: 0 0 0 2px #fff;
}

/* ---- 구역 카드 ---- */
.dash-row {
    display: grid;
    gap: 10px;
}

.dash-row.is-2-1 {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.dash-row.is-auto {
    grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
}

.dash-row.is-pay {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.2fr);
}

.dash-row.is-1-2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

.dash-card {
    position: relative;
    min-width: 0;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.dash-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    min-height: 22px;
    margin-bottom: 6px;
}

.dash-card-title {
    margin: 0;
    color: var(--auth-text);
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 22px;
}

.dash-card-sub {
    color: var(--auth-text-sub);
    font-size: var(--fs-xs);
}

.dash-card-aside {
    margin-left: auto;
    color: var(--auth-text);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.dash-nothing {
    color: var(--auth-text-sub);
    text-align: center;
    padding: 28px 14px;
}

/* 불러오는 중: 본문과 같은 높이의 회색 자리 */
.dash-skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg, #f1f3f6 25%, #e8ebf0 37%, #f1f3f6 63%);
    background-size: 400% 100%;
    animation: dash-shimmer 1.4s ease infinite;
}

@keyframes dash-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .dash-skeleton { animation: none; }
}

.dash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    color: var(--auth-text-sub);
    font-size: var(--fs-sm);
    text-align: center;
}

.dash-empty i {
    color: #c3c2b7;
    font-size: 22px;
}

.dash-empty.is-error i {
    color: var(--dash-bad);
}

/* 랜딩: 카드 하나 안에 세 구역 */
.dash-subgrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.dash-sub-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: var(--fs-sm);
}

.dash-sub-head b {
    font-weight: 600;
}

.dash-sub-head span {
    color: var(--auth-text-sub);
}

/* 화면 낭독기에만 읽히는 값 표 */
.dash-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.dash-foot {
    margin: 2px 2px 0;
    color: var(--auth-text-sub);
    font-size: var(--fs-xs);
}

/* ---- 좁은 화면 ---- */
@media (max-width: 1100px) {
    .dash-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dash-tile.is-hero {
        grid-column: span 3;
    }

    .dash-row.is-auto {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-row.is-2-1,
    .dash-row.is-pay,
    .dash-row.is-1-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-subgrid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 700px) {
    .dash-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-tile.is-hero {
        grid-column: span 2;
    }

    .dash-tile.is-hero .dash-tile-value {
        font-size: 40px;
    }

    .dash-row.is-auto {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-toolbar {
        flex-wrap: wrap;
    }
}
