.detail-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-back {
    margin: 0;
    font-size: 13px;
}

.detail-back a {
    color: var(--ink-secondary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.detail-back a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.detail-header {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 20px;
    align-items: start;
    padding: 24px;
    margin-bottom: 0;
    border: 1px solid var(--line);
    background: var(--white);
}

.detail-header.is-down {
    opacity: 0.55;
}

.detail-header__icon {
    width: 56px;
    height: 56px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.detail-header__title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-header__name {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.detail-header__badge {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border: 1px solid var(--line-strong);
    color: var(--ink-secondary);
}

.detail-header.is-live .detail-header__badge {
    border-color: var(--ink);
    color: var(--ink);
}

.detail-header__host {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--ink-tertiary);
    font-variant-numeric: tabular-nums;
}

.detail-header__motd {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--ink-secondary);
    line-height: 1.45;
}

.detail-header__meta {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--ink-tertiary);
}

.detail-header__now {
    text-align: right;
    padding-left: 20px;
    border-left: 1px solid var(--line);
}

.detail-header__now-label {
    display: block;
    font-size: 11px;
    color: var(--ink-tertiary);
    margin-bottom: 6px;
}

.detail-header__now-value {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.detail-header__now-sub {
    font-size: 16px;
    font-weight: 400;
    color: var(--ink-tertiary);
}

.detail-header__now-off {
    font-size: 20px;
    color: var(--ink-tertiary);
}

.detail-insights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

.detail-insight {
    padding: 16px 18px;
    border: 1px solid var(--line);
    background: var(--white);
}

.detail-insight__label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-tertiary);
    margin-bottom: 8px;
}

.detail-insight__value {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.detail-insight__value--sm {
    font-size: 17px;
    line-height: 1.35;
}

.detail-insight__sub {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ink-tertiary);
    line-height: 1.4;
}

.detail-block {
    margin-bottom: 0;
    padding: 22px 22px 20px;
    border: 1px solid var(--line);
    background: var(--white);
}

.detail-block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.detail-block__head .detail-block__title {
    margin: 0;
}

.detail-block__title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.detail-block__desc {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ink-tertiary);
    line-height: 1.45;
}

.detail-block__scroll {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 4px 4px 0;
    -webkit-overflow-scrolling: touch;
}

.detail-heatmap-canvas {
    min-width: 0;
}

.detail-heatmap-canvas--empty {
    padding: 48px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-tertiary);
}

.detail-block__subhead {
    margin: 20px 0 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-tertiary);
}

.detail-block__title + .detail-block__subhead {
    margin-top: 18px;
}

.detail-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.detail-grid-2 .detail-block {
    height: 100%;
}

.detail-range {
    display: flex;
    gap: 4px;
}

.detail-range__btn {
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink-secondary);
    cursor: pointer;
}

.detail-range__btn.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--white);
}

.detail-chart-legend {
    display: flex;
    gap: 20px;
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-tertiary);
}

.detail-chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.detail-chart-legend__swatch {
    display: inline-block;
    width: 20px;
    height: 3px;
    background: var(--ink);
}

.detail-chart-legend__swatch--dash {
    background: transparent;
    border-top: 2px dashed var(--ink-tertiary);
    height: 0;
}

.detail-fill-chart {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.detail-fill-chart--empty {
    font-size: 13px;
    color: var(--ink-tertiary);
    text-align: center;
}

.detail-fill-row {
    display: grid;
    grid-template-columns: 56px 1fr 44px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.detail-fill-row__label {
    color: var(--ink-secondary);
}

.detail-fill-row__track {
    height: 8px;
    background: var(--line);
}

.detail-fill-row__bar {
    display: block;
    height: 100%;
    background: var(--ink);
}

.detail-fill-row__val {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.detail-activity-wrap {
    min-width: min(100%, 720px);
}

.detail-activity-hours {
    display: grid;
    grid-template-columns: 28px repeat(24, 1fr);
    gap: 2px;
    font-size: 9px;
    color: var(--ink-tertiary);
    margin-bottom: 6px;
}

.detail-activity-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

.detail-activity-dow {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-secondary);
}

.detail-activity-cells {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 2px;
}

.detail-activity-cells .heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    min-width: 10px;
    max-width: 18px;
}

.detail-rank {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.detail-block__desc + .detail-rank,
.detail-block__title + .detail-rank {
    margin-top: 0;
}

.detail-rank__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.detail-rank__row:first-child {
    border-top: none;
    padding-top: 14px;
}

.detail-rank__row:last-child {
    padding-bottom: 4px;
}

.detail-rank__n {
    width: 22px;
    font-weight: 600;
    color: var(--ink-tertiary);
    text-align: center;
}

.detail-rank__label {
    flex: 1;
    color: var(--ink);
}

.detail-rank__val {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.detail-rank__empty {
    padding: 12px 0;
    font-size: 13px;
    color: var(--ink-tertiary);
}

.detail-rank--compact {
    margin-top: 0;
}

.detail-rank--compact .detail-rank__row {
    padding: 10px 0;
}

.detail-rank--compact .detail-rank__row:first-child {
    padding-top: 12px;
}

.detail-stats--compact {
    margin-bottom: 0;
}

.detail-stats--compact .detail-stat {
    padding: 14px 16px;
}

.detail-stats--compact .detail-stat__value {
    font-size: 20px;
}

.detail-stats--grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

.detail-stat__value--sm {
    font-size: 22px;
}

.detail-stat__sep {
    font-weight: 400;
    color: var(--ink-tertiary);
    margin: 0 2px;
}

.detail-stat__unit {
    font-size: 14px;
    font-weight: 400;
    color: var(--ink-tertiary);
}

.detail-stat {
    padding: 20px 18px;
    border: 1px solid var(--line);
    background: var(--white);
}

.detail-stat__label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-tertiary);
    margin-bottom: 8px;
}

.detail-stat__value {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--ink);
}

.detail-stat__sub {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ink-tertiary);
    line-height: 1.35;
}

.detail-charts {
    margin-bottom: 40px;
    padding: 24px;
    border: 1px solid var(--line);
    background: var(--white);
}

.detail-charts__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.detail-charts__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.detail-tabs {
    display: flex;
    gap: 4px;
}

.detail-tabs__btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    color: var(--ink-secondary);
    background: var(--white);
    border: 1px solid var(--line);
    cursor: pointer;
}

.detail-tabs__btn:hover {
    color: var(--ink);
    border-color: var(--line-strong);
}

.detail-tabs__btn.is-active {
    color: var(--white);
    background: var(--ink);
    border-color: var(--ink);
}

.detail-chart-panel {
    min-height: 220px;
}

.detail-chart-wrap {
    position: relative;
    width: 100%;
    height: 220px;
}

.detail-chart-wrap--tall {
    height: 280px;
}

.detail-chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.detail-chart-wrap--empty .chart-empty-msg,
.chart-empty-msg {
    margin: 0;
    padding: 48px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-tertiary);
    border: 1px dashed var(--line);
}

/* 1년 히트맵 — 단일 카드 안 플랫 캔버스 */
.detail-block--year .detail-block__scroll {
    padding-bottom: 4px;
}

.heatmap-year {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    min-width: min-content;
}

.heatmap-year__dow {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 0;
    flex-shrink: 0;
}

.heatmap-year__dow span {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 20px;
    height: 11px;
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-tertiary);
    line-height: 1;
}

.heatmap-year__main {
    flex: 1;
    min-width: 0;
}

.heatmap-year__grid {
    display: flex;
    gap: 3px;
}

.heatmap-year__week {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-cell {
    display: block;
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    background: #f2f2f2;
    border-radius: 1px;
}

.heatmap-cell--1 { background: #e6e6e6; }
.heatmap-cell--2 { background: #c4c4c4; }
.heatmap-cell--3 { background: #969696; }
.heatmap-cell--4 { background: #5a5a5a; }
.heatmap-cell--5 { background: #1a1a1a; }

.detail-heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--ink-tertiary);
}

.detail-heatmap-legend__label {
    white-space: nowrap;
}

.detail-heatmap-legend .heatmap-cell {
    width: 10px;
    height: 10px;
}

.detail-block .detail-heatmap-legend {
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 900px) {
    .detail-insights {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-grid-2 {
        grid-template-columns: 1fr;
    }

    .detail-stats--grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-header {
        grid-template-columns: 56px 1fr;
    }

    .detail-header__now {
        grid-column: 1 / -1;
        text-align: left;
        border-left: none;
        border-top: 1px solid var(--line);
        padding: 16px 0 0;
    }
}

@media (max-width: 640px) {
    .detail-insights {
        grid-template-columns: 1fr;
    }

    .detail-stats--grid {
        grid-template-columns: 1fr;
    }

    .detail-header {
        grid-template-columns: 48px 1fr;
        padding: 16px;
    }

    .detail-header__icon {
        width: 48px;
        height: 48px;
    }
}

.hwc-panel {
    margin-top: 0;
}

.hwc-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hwc-card {
    padding: 20px;
    border: 1px solid var(--line);
    background: var(--white);
}

.hwc-section-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.hwc-section-desc {
    margin: 0 0 14px;
    font-size: 12px;
    color: var(--ink-tertiary);
}

.hwc-chart-wrap--overview {
    height: 260px;
    margin-bottom: 0;
    border: 1px solid var(--line);
    background: var(--white);
    padding: 16px;
}

.hwc-chart-wrap--overview canvas,
.hwc-chart-wrap--hourly canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.hwc-chart-wrap--hourly {
    margin-bottom: 12px;
}

.hwc-overview-table-host {
    margin-bottom: 0;
}

.hwc-dow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.hwc-dow__btn {
    min-width: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.hwc-dow__btn:hover {
    color: var(--ink);
    border-color: var(--ink-muted, #ccc);
}

.hwc-dow__btn.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--white);
}

.hwc-meta {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ink-tertiary);
    line-height: 1.5;
}

.hwc-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    background: var(--white);
    margin-top: 16px;
}

.hwc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.hwc-table th,
.hwc-table td {
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    text-align: right;
    white-space: nowrap;
}

.hwc-table thead th {
    border-top: none;
    font-weight: 600;
    color: var(--ink-secondary);
    background: var(--bg);
}

.hwc-table tbody th {
    text-align: left;
    font-weight: 500;
    color: var(--ink);
    background: var(--white);
    position: sticky;
    left: 0;
    z-index: 1;
}

.hwc-change--up {
    color: #0a7a3e;
    font-weight: 600;
}

.hwc-change--down {
    color: #b42318;
    font-weight: 600;
}

.hwc-row--clickable {
    cursor: pointer;
}

.hwc-row--clickable:hover th,
.hwc-row--clickable:hover td {
    background: var(--bg);
}

.hwc-row--active th,
.hwc-row--active td {
    background: var(--bg);
}

.hwc-row--active th {
    font-weight: 600;
    color: var(--ink);
}
