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

:root {
    --bg: #f5f7fa;
    --sidebar-bg: #1a2332;
    --sidebar-text: #94a3b8;
    --sidebar-active: #e2e8f0;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 360px;
}
.login-card h1 {
    font-size: 22px;
    margin-bottom: 24px;
    text-align: center;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
}
.logo {
    font-size: 18px;
    font-weight: 700;
    color: white;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}
.nav-item {
    display: block;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-item.active { color: white; background: rgba(59,130,246,0.3); border-right: 3px solid var(--primary); }
.nav-sub { padding-left: 32px; font-size: 13px; }
.nav-group-label { padding: 16px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #475569; }
.nav-spacer { flex: 1; }
.nav-logout { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 10px; }

/* Content */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    max-width: 960px;
}
h1 { font-size: 24px; margin-bottom: 20px; }
h2 { font-size: 18px; margin-bottom: 12px; }

/* Cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h3 { font-size: 16px; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.card-links { display: flex; flex-direction: column; gap: 4px; }
.card-links a { font-size: 13px; color: var(--primary); text-decoration: none; }
.card-links a:hover { text-decoration: underline; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.code-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background: #fafbfc;
}
.form-actions { display: flex; gap: 12px; margin-top: 16px; }
.help-text { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.help-text code { background: #f1f5f9; padding: 2px 5px; border-radius: 3px; font-size: 12px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: var(--border);
    transition: all 0.2s;
}
.btn:hover { background: #cbd5e1; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Badges */
.badge { font-size: 12px; padding: 4px 10px; border-radius: 12px; font-weight: 500; }
.badge-custom { background: #dbeafe; color: #1e40af; }
.badge-default { background: #f1f5f9; color: #475569; }

.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-header h1 { margin-bottom: 0; }

/* Extra prompts */
.extra-prompt-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.extra-prompt-card.disabled { opacity: 0.5; }
.extra-prompt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.extra-prompt-actions { display: flex; gap: 6px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.data-table th { background: #f8fafc; text-align: left; padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }

/* Upload */
.upload-form { display: flex; gap: 12px; align-items: center; }
.upload-form input[type="file"] { font-size: 14px; }

/* Default prompt preview */
.default-prompt {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}
details summary { cursor: pointer; font-size: 14px; color: var(--text-muted); margin-top: 16px; }

.empty-state { color: var(--text-muted); font-style: italic; padding: 20px 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 24px; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 16px; }
    .cards { grid-template-columns: 1fr; }
}
