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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

nav {
    background: #1e293b;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
nav .brand { color: #fff; font-weight: 700; font-size: 1.1em; text-decoration: none; }
nav a { color: #94a3b8; text-decoration: none; font-size: 0.9em; padding: 4px 8px; border-radius: 4px; }
nav a:hover, nav a.active { color: #fff; background: #334155; }

h1 { font-size: 1.5em; margin-bottom: 16px; color: #0f172a; }
h2 { font-size: 1.2em; margin-bottom: 12px; color: #1e293b; }

/* Cards */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.stat-card .number { font-size: 2em; font-weight: 700; color: #2563eb; }
.stat-card .label { font-size: 0.85em; color: #64748b; margin-top: 4px; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f1f5f9; font-weight: 600; color: #475569; }
tr:hover { background: #f8fafc; }

/* Buttons */
btn, .btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9em; font-weight: 500; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }
.btn-sm { padding: 4px 10px; font-size: 0.8em; }

/* Forms */
input, textarea, select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: inherit;
}
textarea { min-height: 200px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 0.9em; color: #475569; }
.form-group { margin-bottom: 12px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row > * { flex: 1; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-generated { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-running { background: #dbeafe; color: #1e40af; }

/* Progress bar */
.progress-bar { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #2563eb; border-radius: 4px; transition: width 0.3s; }

/* Preview panel */
.preview-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid #e2e8f0; }
.tab {
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.9em;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

/* Utility */
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.text-muted { color: #64748b; font-size: 0.85em; }
.text-right { text-align: right; }
.hidden { display: none; }

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 800px; width: 90%; max-height: 80vh; overflow-y: auto; }

/* Toast */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    padding: 12px 20px; border-radius: 8px;
    color: #fff; font-size: 0.9em;
    z-index: 2000; animation: fadeIn 0.3s;
}
.toast-success { background: #16a34a; }
.toast-error { background: #ef4444; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
