/* 법인세 분석 보고서 8개 섹션 화면.
   upload.css · report_detail.css 를 함께 로드해 공통 컴포넌트를 재사용한다. */

.report-view {
    max-width: 1000px;
}

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 20px 0 8px;
}

.section-nav a {
    padding: 4px 10px;
    font-size: 0.78rem;
    text-decoration: none;
    color: hsl(var(--secondary-foreground));
    background-color: hsl(var(--secondary));
    border-radius: 999px;
}

.section-nav a:hover {
    background-color: hsl(var(--accent));
}

.section-nav a.muted {
    color: hsl(var(--muted-foreground));
    background-color: hsl(var(--muted));
}

.report-section {
    padding: 20px;
    margin-bottom: 20px;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    scroll-margin-top: 16px;
}

.report-section.muted {
    background-color: hsl(var(--muted));
}

.report-section .section-title {
    margin: 0 0 14px;
}

.sub-title {
    margin: 20px 0 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.report-note {
    margin: 10px 0 0;
    font-size: 0.8rem;
    line-height: 1.7;
    color: hsl(var(--muted-foreground));
}

/* --- I. 기본사항 --- */

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

.basics-cell dt {
    font-size: 0.72rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 3px;
}

.basics-cell dd {
    margin: 0;
    font-size: 0.9rem;
    color: hsl(var(--foreground));
    word-break: break-all;
}

/* --- II. 요약 카드 --- */

.summary-grid.cards {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 16px;
}

.summary-cell.card {
    padding: 14px 16px;
    background-color: hsl(var(--secondary));
}

.summary-cell.card dd {
    font-size: 1.35rem;
}

.card-diff {
    margin-top: 6px;
    font-size: 0.8rem;
}

/* --- 표 --- */

.report-table thead th {
    font-size: 0.74rem;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border));
    text-align: right;
}

.report-table thead th.text,
.report-table tbody th.text,
.report-table td.text {
    text-align: left;
    font-variant-numeric: normal;
    width: auto;
    /* 금액 열이 nowrap 이라 폭을 먼저 차지한다. 최소폭이 없으면 항목명 열이
       최소 너비까지 눌려 한국어가 한 글자씩 세로로 쌓인다. */
    min-width: 180px;
    white-space: normal;
    word-break: keep-all;
}

.report-table tbody th {
    font-weight: 500;
    color: hsl(var(--foreground));
}

.report-table td {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.report-table tr.total-row th,
.report-table tr.total-row td {
    font-weight: 600;
    border-top: 1px solid hsl(var(--border));
}

.report-table tr.expiring th {
    color: hsl(var(--destructive));
}

/* 증가=파랑, 감소=빨강 (원 스펙) */
.up { color: hsl(217 91% 45%); }
.down { color: hsl(var(--destructive)); }

.na {
    color: hsl(var(--muted-foreground));
    font-size: 0.8rem;
}

.kind-label {
    padding: 1px 7px;
    font-size: 0.72rem;
    border-radius: 999px;
    color: hsl(var(--secondary-foreground));
    background-color: hsl(var(--secondary));
}

.warn-mark {
    color: hsl(var(--destructive));
    font-size: 0.72rem;
    font-weight: 600;
}

@media (max-width: 720px) {
    .basics-grid,
    .summary-grid.cards {
        grid-template-columns: 1fr;
    }
}

/* --- 코멘트 (개발 스펙 Step 6) --- */

.comment-box {
    margin-top: 16px;
    padding: 14px 16px;
    background-color: hsl(var(--secondary));
    border-left: 3px solid hsl(var(--primary));
    border-radius: var(--radius);
}

.comment-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.comment-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
}

.comment-body {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.8;
    color: hsl(var(--foreground));
    white-space: pre-wrap;
}

.comment-note {
    margin: 8px 0 0;
    font-size: 0.74rem;
    color: hsl(var(--destructive));
}

.source-badge {
    padding: 1px 7px;
    font-size: 0.68rem;
    border-radius: 999px;
    color: hsl(var(--secondary-foreground));
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
}

/* --- 조정료 수행 업무 목록 (개발 스펙 Step 7) --- */

.work-list {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
}

.work-list label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.85rem;
    color: hsl(var(--foreground));
    cursor: pointer;
}

@media (max-width: 720px) {
    .work-list {
        grid-template-columns: 1fr;
    }
}

/* --- 편집 (개발 스펙 Step 8) --- */

.editable {
    cursor: pointer;
    border-bottom: 1px dashed hsl(var(--border));
}

.editable:hover {
    background-color: hsl(var(--accent));
}

/* 수정된 셀은 배경으로 구분하고 hover 로 원본값을 보여준다. */
.editable.edited {
    padding: 1px 5px;
    border-radius: 4px;
    border-bottom: none;
    font-weight: 600;
    color: hsl(43 96% 25%);
    background-color: hsl(43 96% 56% / 0.22);
}

.comment-input {
    width: 100%;
    margin: 8px 0;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.86rem;
    line-height: 1.7;
    color: hsl(var(--foreground));
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    resize: vertical;
}

.comment-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
}

.chart-box {
    position: relative;
    height: 300px;
    margin-top: 16px;
}

#display-panel summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

/* --- 확정·다운로드 (개발 스펙 Step 9) --- */

.download-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.download-actions .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
    text-decoration: none;
}

/* --- 보고서 목록 --- */

/* 비교표는 항목명이 길어 min-width 가 필요하지만(Issue #5), 목록 표는 열이 6개라
   같은 최소폭(180px)을 주면 표가 1,030px 로 불어나 마지막 열이 잘린다.
   `.report-table thead th.text` 와 특이도를 맞춰야 이긴다 — `.list-table th.text` 만으로는
   선택자 특이도가 낮아 무시된다. */
.report-table.list-table thead th.text,
.report-table.list-table tbody th.text,
.report-table.list-table td.text {
    min-width: 0;
}

.report-table.list-table thead th.text:first-child,
.report-table.list-table tbody th.text:first-child {
    min-width: 160px;
}

/* 바로가기 링크 3개가 한 줄에 들어갈 폭. */
.report-table.list-table thead th.text:last-child,
.report-table.list-table td.text:last-child {
    min-width: 150px;
}

.list-search {
    display: flex;
    gap: 6px;
    align-items: center;
}

.list-search input[type="search"] {
    padding: 8px 12px;
    min-width: 240px;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
}

.list-search input[type="search"]:focus {
    outline: none;
    border-color: hsl(var(--ring));
}

.list-links {
    display: flex;
    gap: 10px;
    white-space: nowrap;
}

.list-links a {
    font-size: 0.8rem;
    color: hsl(217 91% 45%);
    text-decoration: none;
}

.list-links a:hover {
    text-decoration: underline;
}

/* --- 미확인 식별 정보 보정 --- */

.identity-box {
    margin-top: 16px;
    padding: 16px;
    background-color: hsl(38 92% 50% / 0.08);
    border: 1px solid hsl(38 92% 50% / 0.4);
    border-radius: var(--radius);
}

.identity-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    color: hsl(25 90% 32%);
}
