/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

/* ── Nav ──────────────────────────────────────────────────── */
nav {
    background: #1a1a1a;
    color: #fff;
    padding: 0 1.5rem;
    height: 52px;
    display: flex;
    align-items: center;
}

.nav-inner {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-link {
    color: #aaa;
    text-decoration: none;
    font-size: 0.85rem;
}

.nav-link:hover { color: #fff; }

/* ── Main ─────────────────────────────────────────────────── */
main {
    max-width: 720px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card.center { text-align: center; }

h1 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #777;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ── Forms ────────────────────────────────────────────────── */
input[type="password"],
input[type="text"] {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 1rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

input:focus {
    outline: none;
    border-color: #4a9;
    box-shadow: 0 0 0 2px rgba(68,170,153,0.2);
}

button, .btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    background: #2a7d5f;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

button:hover, .btn:hover { background: #236b50; }
button:disabled { background: #ccc; cursor: not-allowed; }

.btn-secondary {
    background: #555;
}

.btn-secondary:hover { background: #444; }

/* ── Flash ────────────────────────────────────────────────── */
.flash {
    background: #fff3cd;
    color: #856404;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ── Dropzone ─────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2.5rem 1rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 0.5rem;
}

.dropzone:hover, .dropzone.dragover {
    border-color: #4a9;
    background: #f0faf6;
}

.dropzone-text {
    color: #888;
    font-size: 0.95rem;
}

.dropzone input[type="file"] {
    display: none;
}

.file-name {
    font-size: 0.85rem;
    color: #555;
    min-height: 1.2rem;
    margin-bottom: 1rem;
}

#submit-btn {
    width: 100%;
}

/* ── Upload note ──────────────────────────────────────────── */
.upload-note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #999;
    text-align: center;
}

/* ── Processing ───────────────────────────────────────────── */
.progress-container {
    padding: 2rem 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: #2a7d5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.progress-text {
    color: #555;
    font-size: 0.9rem;
}

.error-box {
    background: #fce4e4;
    color: #c0392b;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* ── Results ──────────────────────────────────────────────── */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.stats-table th,
.stats-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
}

.stats-table th {
    color: #999;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stats-table td:nth-child(2),
.stats-table td:nth-child(3),
.stats-table th:nth-child(2),
.stats-table th:nth-child(3) {
    text-align: right;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    text-align: center;
    padding: 0.75rem;
    background: #f9f9f9;
    border-radius: 6px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2a7d5f;
}

.stat-label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.download-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.download-buttons .btn {
    flex: 1;
    text-align: center;
}

.back-link {
    display: block;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    text-decoration: none;
}

.back-link:hover { color: #555; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 500px) {
    .summary-row { grid-template-columns: repeat(2, 1fr); }
    .download-buttons { flex-direction: column; }
}
