:root {
    --bg-from: #f8fafc;
    --bg-to: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #cbd5e1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --success-hover: #15803d;
    --secondary: #475569;
    --secondary-hover: #334155;
}

* {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-from), var(--bg-to));
    color: var(--text-main);
}

.app-shell {
    width: min(1280px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0;
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.hero-title {
    margin: 0 0 0.5rem;
    font-size: 1.875rem;
    line-height: 1.2;
    font-weight: 700;
}

.hero-desc {
    margin: 0;
    color: var(--text-muted);
}

.nav-wrap {
    margin-top: 1.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1rem;
}

.nav-label {
    margin: 0 0 0.75rem;
    color: #64748b;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.nav-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.nav-item {
    display: block;
    text-decoration: none;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.nav-item:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.nav-item.current {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.nav-item.placeholder {
    border-style: dashed;
    background: #f1f5f9;
    opacity: 0.8;
    pointer-events: none;
}

.nav-item-kicker {
    margin: 0;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.nav-item.current .nav-item-kicker {
    color: var(--primary);
}

.nav-item-title {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.section-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pill {
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.dropzone:hover {
    border-color: #60a5fa;
}

.dropzone-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #94a3b8;
}

.dropzone-title {
    margin: 0 0 0.5rem;
    color: #334155;
    font-size: 1.125rem;
}

.dropzone-desc {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

.hidden-input {
    display: none;
}

.file-list {
    margin-top: 1rem;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.field-label {
    display: block;
    color: #334155;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.input-control,
.select-control {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
}

.input-control:focus,
.select-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.select-control {
    cursor: pointer;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-text {
    font-size: 0.875rem;
    color: #334155;
}

.btn {
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

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

.btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.progress-wrap {
    margin-top: 1rem;
}

.progress-track {
    width: 100%;
    height: 0.5rem;
    border-radius: 999px;
    overflow: hidden;
    background: #e2e8f0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.progress-text {
    margin: 0.5rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
    text-align: center;
}

.progress-row {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #64748b;
    font-size: 0.875rem;
}

.stats-box {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    font-size: 0.875rem;
}

.stats-label {
    color: #475569;
}

.stats-value {
    margin-left: 0.5rem;
    color: #0f172a;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #f8fafc;
}

.table tbody {
    background: #fff;
}

.action-row {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.action-row .btn {
    flex: 1;
}

.log-box {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.875rem;
    color: #334155;
    max-height: 16rem;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

@media (min-width: 768px) {
    .nav-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-span-2 {
        grid-column: span 2;
    }

    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

