:root {
    --bg: #171229;
    --surface: #241c3f;
    --surface-hover: #2e2550;
    --border: #453a70;
    --text: #f0eefa;
    --text-muted: #9b93b8;
    --accent-start: #8b5cf6;
    --accent-end: #ec4899;
    --success-bg: rgba(34, 197, 94, .15);
    --success-text: #4ade80;
    --error-bg: rgba(239, 68, 68, .15);
    --error-text: #f87171;
    --pending-bg: rgba(139, 92, 246, .15);
    --pending-text: #c4b5fd;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: system-ui, sans-serif;
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--pending-text); }
a:hover { color: var(--text); }

h1 { font-size: 1.5rem; margin-bottom: 1.25rem; }

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0.9rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
nav .brand {
    font-weight: 700;
    font-size: 1.05rem;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
nav a { margin-right: 1.25rem; color: var(--text); text-decoration: none; font-size: 0.92rem; }
nav a:hover { color: var(--pending-text); }
nav .nav-right { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: 0.9rem; }

.messages { list-style: none; padding: 0; }
.messages li {
    padding: 0.7rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-start);
    border-radius: 8px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

button, .btn {
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    color: #fff;
    border: none;
    padding: 0.65em 1.5em;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.15s ease;
}
button:hover, .btn:hover { opacity: 0.88; }
nav button, nav a.btn { padding: 0.35em 1em; font-size: 0.85rem; font-weight: 500; }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    text-decoration: none;
    display: inline-block;
}
.btn-secondary:hover { background: var(--surface-hover); opacity: 1; color: var(--text); }

form.upload-form, form.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}
form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; color: var(--text-muted); }
form input[type="text"],
form input[type="password"] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6em 0.8em;
    color: var(--text);
    font-size: 1rem;
}
form input:focus { outline: 2px solid var(--accent-start); outline-offset: 1px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.25em 0.75em;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge.status-done { background: var(--success-bg); color: var(--success-text); }
.status-badge.status-failed { background: var(--error-bg); color: var(--error-text); }
.status-badge.status-pending,
.status-badge.status-downloading,
.status-badge.status-extracting_audio,
.status-badge.status-transcribing,
.status-badge.status-calling_llm,
.status-badge.status-validating,
.status-badge.status-retrying_pro,
.status-badge.status-uploading_result { background: var(--pending-bg); color: var(--pending-text); }
.status-dot {
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: currentColor;
    animation: status-pulse 1.2s ease-in-out infinite;
}
@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* Job list */
.job-list { display: flex; flex-direction: column; gap: 0.75rem; }
.job-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    transition: background 0.15s ease, transform 0.15s ease;
}
.job-card:hover { background: var(--surface-hover); }
.job-card .job-main { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.job-card .job-filename { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-card .job-date { font-size: 0.82rem; color: var(--text-muted); }
.job-card .job-side { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.job-card .job-actions { font-size: 0.85rem; white-space: nowrap; padding: 0.4em 1em; }
.job-list-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* Upload dropzone */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
    padding: 2.5rem 1.5rem;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--accent-start); background: var(--surface-hover); }
.dropzone input[type="file"] { display: none; }
.dropzone .dropzone-title { font-weight: 600; }
.dropzone .dropzone-hint { font-size: 0.85rem; color: var(--text-muted); }
.dropzone .dropzone-filename { font-size: 0.9rem; color: var(--pending-text); }

progress {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    appearance: none;
    border: none;
    background: var(--border);
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent-start), var(--accent-end)); border-radius: 999px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent-start), var(--accent-end)); border-radius: 999px; }

.hint { color: var(--text-muted); font-size: 0.9em; }

.result-text {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin: 0;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
    color: var(--text);
}
.error-text { color: var(--error-text); }

.login-wrap { display: flex; justify-content: center; margin-top: 3rem; }
.login-wrap .card { width: 100%; max-width: 360px; }
