* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
    --success: 142.1 76.2% 36.3%;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    min-height: 100vh;
    padding: 1.5rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
    letter-spacing: -0.025em;
    line-height: 1.2;
}

header p {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Drop Zone Container */
.drop-zone-container {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 2px);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.drop-zone {
    position: relative;
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: hsl(var(--muted) / 0.5);
}

.drop-zone:hover {
    border-color: hsl(var(--foreground) / 0.3);
    background: hsl(var(--muted) / 0.8);
}

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

.drop-zone-content {
    position: relative;
    z-index: 2;
}

.drop-icon {
    color: hsl(var(--muted-foreground));
    margin: 0 auto 1rem;
    display: block;
    transition: color 0.15s ease;
}

.drop-zone:hover .drop-icon {
    color: hsl(var(--foreground));
}

.drop-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
}

.drop-subtext {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.75rem;
}

#fileInput {
    display: none;
}

.privacy-note {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.75rem;
}

.drop-zone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(var(--foreground) / 0.03);
    opacity: 0;
    transition: opacity 0.15s ease;
    border-radius: var(--radius);
    pointer-events: none;
}

.drop-zone.drag-over .drop-zone-overlay {
    opacity: 1;
}

/* Loading in drop zone */
.drop-zone-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.drop-zone-loading .loading-text {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.spinner-small {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid hsl(var(--border));
    border-top-color: hsl(var(--foreground));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* File List */
.file-list {
    margin-top: 1rem;
    display: none;
}

.file-list.has-files {
    display: block;
}

.file-summary {
    padding: 0.75rem 1rem;
    background: hsl(var(--muted) / 0.5);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.file-summary:hover {
    background: hsl(var(--muted));
}

.file-summary-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-summary-chevron {
    color: hsl(var(--muted-foreground));
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.file-summary.expanded .file-summary-chevron {
    transform: rotate(180deg);
}

.file-summary strong {
    font-weight: 600;
    color: hsl(var(--foreground));
}

.file-items {
    margin-top: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-name {
    font-weight: 400;
    color: hsl(var(--foreground));
    flex: 1;
}

.file-status {
    font-size: 0.75rem;
    margin-left: 0.75rem;
    font-weight: 500;
}

.file-status.processing {
    color: hsl(var(--muted-foreground));
}

.file-status.success {
    color: hsl(var(--success));
}

.file-status.error {
    color: hsl(var(--destructive));
}

/* Controls */
.controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    height: 2.25rem;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-primary:hover:not(:disabled) {
    background: hsl(var(--primary) / 0.9);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:hover {
    background: hsl(var(--secondary) / 0.8);
}

.btn.hidden {
    display: none;
}

/* Preview Section */
.preview-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 2px);
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.preview-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
    letter-spacing: -0.025em;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
}

table {
    width: 100%;
    border-collapse: collapse;
    background: hsl(var(--card));
}

thead {
    background: hsl(var(--muted) / 0.5);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border));
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

tbody tr:hover {
    background: hsl(var(--muted) / 0.5);
}

tbody tr:last-child td {
    border-bottom: none;
}

.empty-row td {
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-style: normal;
    padding: 3rem 1rem;
    font-size: 0.875rem;
}

.amount {
    font-weight: 500;
    white-space: nowrap;
}

.amount.negative {
    color: hsl(var(--destructive));
}

.amount.positive {
    color: hsl(var(--success));
}

/* Stats */
.stats {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: hsl(var(--muted) / 0.5);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    border: 1px solid hsl(var(--border));
}

.stats strong {
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header {
        margin-bottom: 1.5rem;
    }

    .drop-zone-container {
        padding: 1rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .preview-section {
        padding: 1rem;
    }

    table {
        font-size: 0.8125rem;
    }

    th, td {
        padding: 0.625rem 0.75rem;
    }
}
