:root {
    color-scheme: light;
    font-family: Inter, "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    color: #172033;
    background: #f3f6fb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        radial-gradient(circle at 15% 10%, #dce9ff 0, transparent 35%),
        radial-gradient(circle at 85% 90%, #dcfce7 0, transparent 35%),
        #f7f9fc;
}

.card {
    width: min(820px, 100%);
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e5eaf2;
    border-radius: 24px;
    padding: clamp(24px, 5vw, 48px);
    box-shadow: 0 24px 70px rgba(30, 56, 95, .12);
}

.page-header,
.job-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.eyebrow {
    color: #2563eb;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .11em;
}

h1 { margin: 10px 0 12px; font-size: clamp(30px, 6vw, 46px); line-height: 1.15; }
h2 { margin: 12px 0 0; font-size: 22px; overflow-wrap: anywhere; }
.lead { color: #596579; line-height: 1.8; margin: 0 0 28px; }

form { display: grid; gap: 14px; }
.upload-form, .login-form { margin-top: 24px; }
.logout-form { display: block; }
label { font-weight: 750; }

input[type="file"],
input[type="password"] {
    width: 100%;
    border: 1px solid #b7c1d1;
    border-radius: 14px;
    background: #f8fafc;
    padding: 16px;
    font: inherit;
}

input[type="file"] { border-style: dashed; }
input:focus { outline: 3px solid rgba(37, 99, 235, .16); border-color: #2563eb; }
small, .refresh-note { color: #64748b; line-height: 1.8; }
code { direction: ltr; display: inline-block; background: #eaf0ff; padding: 1px 6px; border-radius: 5px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 13px 20px;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.button:disabled { opacity: .5; cursor: not-allowed; }
.primary { color: white; background: #2563eb; box-shadow: 0 8px 20px rgba(37, 99, 235, .2); }
.primary:hover:not(:disabled) { background: #1d4ed8; }
.secondary { color: #1e40af; background: #eaf0ff; }
.text-button { border: 0; background: transparent; color: #475569; text-decoration: underline; cursor: pointer; font: inherit; white-space: nowrap; }

.alert { border-radius: 12px; padding: 14px 16px; margin: 18px 0; line-height: 1.7; overflow-wrap: anywhere; }
.alert.error { color: #991b1b; background: #fee2e2; }
.alert.warning { color: #92400e; background: #fef3c7; }

.job-card { margin: 10px 0 28px; padding: 22px; border: 1px solid #dbe3ee; border-radius: 18px; background: #fbfdff; }
.job-id { color: #64748b; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; }
.status { display: inline-block; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; }
.status.queued { color: #92400e; background: #fef3c7; }
.status.processing { color: #1e40af; background: #dbeafe; }
.status.completed { color: #166534; background: #dcfce7; }
.status.completed_with_errors { color: #9a3412; background: #ffedd5; }

.progress { height: 9px; margin: 22px 0; overflow: hidden; border-radius: 999px; background: #e7ecf3; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #22c55e); transition: width .3s ease; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats div { display: grid; gap: 3px; text-align: center; padding: 12px 6px; border-radius: 12px; background: #f1f5f9; }
.stats strong { font-size: 21px; }
.stats span { color: #64748b; font-size: 12px; }

aside { margin-top: 24px; padding: 16px; border-radius: 12px; background: #fff7ed; color: #9a3412; line-height: 1.8; }

@media (max-width: 620px) {
    .page-header, .job-heading { align-items: stretch; flex-direction: column; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .actions .button { width: 100%; }
}
