/* ─── Tax Reports Upload Page ─────────────────────────────────────────────── */

.upload-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ─── Drop Zone ─────────────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    background: hsl(var(--muted));
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.drop-zone.drag-over {
    border-color: hsl(var(--primary));
    background: hsl(var(--accent));
}

.drop-zone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: hsl(var(--muted-foreground));
}

.drop-zone-title {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0 0 8px 0;
}

.drop-zone-sub {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin: 0 0 20px 0;
}

.drop-zone input[type="file"] {
    display: none;
}

/* ─── Selected Files List ───────────────────────────────────────────────────── */
.file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    text-align: left;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 9999px;
    font-size: 0.75rem;
    color: hsl(var(--foreground));
}

.file-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: hsl(var(--muted-foreground));
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s;
}

.file-chip-remove:hover {
    color: hsl(var(--destructive));
}

/* ─── CMS Date Field ────────────────────────────────────────────────────────── */
.cms-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
}

.cms-section .input-group {
    margin-bottom: 0;
}

.cms-section input[type="date"] {
    height: 40px;
    padding: 0 12px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    width: 200px;
}

.cms-section input[type="date"]:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* ─── Upload Actions ────────────────────────────────────────────────────────── */
.upload-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.file-count-label {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* ─── Progress ──────────────────────────────────────────────────────────────── */
.upload-progress {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
}

.upload-progress-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin: 0 0 12px 0;
}

/* ─── Results ───────────────────────────────────────────────────────────────── */
.results-section {
    margin-top: 24px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.results-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0;
}

.batch-slug {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-family: monospace;
}

.report-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.report-card:hover {
    background: hsl(var(--accent));
    border-color: hsl(var(--primary) / 0.3);
}

.report-card-info {
    flex: 1;
    min-width: 0;
}

.report-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: hsl(var(--foreground));
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-card-meta {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.report-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.badge-warning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: hsl(48 96% 89%);
    color: hsl(25 95% 40%);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-ok {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: hsl(142 76% 90%);
    color: hsl(142 76% 36%);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.fee-amount {
    font-size: 0.9375rem;
    font-weight: 600;
    color: hsl(var(--primary));
    white-space: nowrap;
}

.batch-warnings-box {
    background: hsl(48 96% 89%);
    border: 1px solid hsl(48 96% 70%);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 12px;
}

.batch-warnings-box h4 {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(25 95% 40%);
}

.batch-warnings-box ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.8125rem;
    color: hsl(25 95% 40%);
}

.batch-warnings-box ul li {
    margin-bottom: 4px;
}

.arrow-icon {
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

/* ─── Upload page nav ───────────────────────────────────────────────────────── */
.upload-page-nav {
    margin-bottom: 24px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: color 0.15s;
}

.nav-link:hover {
    color: hsl(var(--foreground));
}

/* ─── Report list page ──────────────────────────────────────────────────────── */
.report-list-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.report-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
}

.report-list-table th {
    background: hsl(var(--muted));
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border));
}

.report-list-table td {
    padding: 10px 14px;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    color: hsl(var(--foreground));
}

.report-list-table tr:last-child td {
    border-bottom: none;
}

.report-list-table tbody tr:hover td {
    background: hsl(var(--muted) / 0.5);
}

.report-list-table a {
    color: hsl(var(--primary));
    text-decoration: none;
    font-weight: 500;
}

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

/* ─── Report detail page ────────────────────────────────────────────────────── */
.report-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.report-main {
    min-width: 0;
}

/* Report page header */
.report-page-header {
    margin-bottom: 20px;
}

.report-page-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.report-page-header .meta {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.summary-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
}

.summary-card-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.summary-card-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin-bottom: 4px;
}

.summary-card-change {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    min-height: 16px;
}

/* Validation warnings */
.warnings-box {
    background: hsl(48 96% 89%);
    border: 1px solid hsl(48 96% 70%);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
}

.warnings-box h3 {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(25 95% 40%);
}

.warnings-box ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.8125rem;
    color: hsl(25 95% 40%);
}

.warnings-box ul li {
    margin-bottom: 3px;
}

/* Report section */
.report-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
}

.section-title {
    background: hsl(221 47% 25%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 9px 14px;
    margin: 0;
}

.section-subtitle {
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    padding: 10px 14px 6px 14px;
    margin: 0;
    background: hsl(var(--muted) / 0.4);
    border-top: 1px solid hsl(var(--border) / 0.5);
}

/* Report tables */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.report-table th {
    background: hsl(var(--muted));
    font-weight: 600;
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    font-size: 0.775rem;
}

.report-table td {
    padding: 4px 10px;
    border-bottom: 1px solid hsl(var(--border) / 0.4);
    color: hsl(var(--foreground));
}

.report-table tr:last-child td {
    border-bottom: none;
}

.report-table td:first-child {
    text-align: left;
}

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

.report-table tr.total-row td {
    font-weight: 700;
    background: hsl(var(--muted) / 0.6);
    border-top: 1px solid hsl(var(--border));
}

.report-table tr.warn-row td {
    background: hsl(48 96% 89%);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 14px;
}

.chart-label {
    font-size: 0.775rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    margin: 0 0 6px 0;
    text-align: center;
}

.chart-container {
    position: relative;
    height: 200px;
}

/* Comment area */
.comment-area {
    padding: 14px;
}

.comment-textarea {
    width: 100%;
    min-height: 160px;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.6;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    resize: vertical;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.comment-textarea:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.comment-textarea:disabled {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    cursor: default;
}

.autosave-indicator {
    font-size: 0.75rem;
    color: hsl(142 76% 36%);
    margin-top: 6px;
    height: 16px;
    transition: opacity 0.5s;
}

/* Special items list */
.special-items-list {
    margin: 0;
    padding: 14px 14px 14px 30px;
    font-size: 0.8125rem;
    color: hsl(var(--foreground));
    line-height: 1.7;
}

.special-items-list li {
    margin-bottom: 4px;
}

/* ─── Fee panel ─────────────────────────────────────────────────────────────── */
.fee-panel {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    position: sticky;
    top: 20px;
    overflow: hidden;
}

.fee-panel-header {
    background: hsl(221 47% 25%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 10px 14px;
}

.fee-panel-body {
    padding: 14px;
}

.fee-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid hsl(var(--border) / 0.4);
}

.fee-row:last-of-type {
    border-bottom: none;
}

.fee-row-label {
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

.fee-row-value {
    font-weight: 500;
    color: hsl(var(--foreground));
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.fee-sublist {
    padding: 2px 0 4px 8px;
}

.fee-sublist ul {
    margin: 0;
    padding-left: 14px;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    list-style: disc;
}

.fee-sublist li {
    margin-bottom: 2px;
    line-height: 1.5;
}

.fee-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 6px 0;
    font-size: 1rem;
    font-weight: 700;
    color: hsl(var(--primary));
    border-top: 2px solid hsl(var(--border));
    margin-top: 4px;
}

.fee-note {
    font-size: 0.75rem;
    color: hsl(0 84% 50%);
    padding: 4px 0;
    margin: 4px 0 0 0;
    display: none;
}

/* Fee controls */
.fee-controls {
    padding-top: 12px;
    margin-top: 6px;
    border-top: 1px solid hsl(var(--border));
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: hsl(var(--primary));
    flex-shrink: 0;
}

.checkbox-row span {
    font-size: 0.8rem;
    color: hsl(var(--foreground));
    line-height: 1.4;
}

.fee-controls label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    margin-bottom: 4px;
}

.fee-controls input[type="date"] {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    font-size: 0.8rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.fee-controls input[type="date"]:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.fee-controls input[type="date"]:disabled {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

/* Action area */
.action-area {
    padding-top: 14px;
    margin-top: 6px;
    border-top: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.download-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .report-page {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .fee-panel {
        position: static;
    }

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

    .charts-grid {
        grid-template-columns: 1fr;
    }
}
