:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
}

nav {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary);
}

.user {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.logout-form {
    display: inline;
}

.logout-form button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}

.logout-form button:hover {
    color: var(--danger);
}

main {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

h1 {
    font-size: 1.75rem;
    margin: 0 0 1.5rem;
}

h2 {
    font-size: 1.25rem;
    margin: 0 0 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

textarea,
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

textarea:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.text-input {
    min-height: 200px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.diff-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.diff-panel {
    background: #f1f5f9;
    border-radius: var(--radius);
    padding: 1rem;
}

.diff-panel h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.diff-panel pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 0.95rem;
}

.job-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.job-item:last-child {
    border-bottom: none;
}

.job-info {
    flex: 1;
    min-width: 0;
}

.job-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.job-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.job-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-correcting { background: #dbeafe; color: #1e40af; }
.status-generating { background: #e0e7ff; color: #3730a3; }
.status-ready { background: #dcfce7; color: #166534; }
.status-failed { background: #fee2e2; color: #991b1b; }

.audio-player {
    width: 100%;
    margin: 1rem 0;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.login-container {
    max-width: 400px;
    margin: 4rem auto;
}

@media (max-width: 640px) {
    .diff-view {
        grid-template-columns: 1fr;
    }

    .job-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .job-actions {
        margin-left: 0;
        margin-top: 0.75rem;
    }
}
