/* Job Command — sign-in page. Same palette as the dashboard; light by default, dark via theme or system. */
:root {
    --bg: #f4f6fb; --card: #ffffff; --text: #0f172a; --muted: #64748b; --secondary: #475569;
    --border: rgba(15, 23, 42, 0.12); --input: #f1f5f9; --focus: rgba(37, 99, 235, 0.5);
    --blue: #2563eb; --blue-hover: #1d4ed8; --purple: #9333ea; --red: #dc2626; --red-bg: rgba(220, 38, 38, 0.08);
    --amber: #b45309; --green: #16a34a; --shadow: 0 12px 40px rgba(15, 23, 42, 0.10);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a0e1a; --card: #111827; --text: #f1f5f9; --muted: #94a3b8; --secondary: #cbd5e1;
        --border: rgba(255, 255, 255, 0.10); --input: #0d1424; --focus: rgba(99, 128, 255, 0.6);
        --blue: #6380ff; --blue-hover: #4f6ef7; --red: #f87171; --red-bg: rgba(239, 68, 68, 0.12); --amber: #fbbf24;
        --shadow: 0 12px 40px rgba(0, 0, 0, 0.45); color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0a0e1a; --card: #111827; --text: #f1f5f9; --muted: #94a3b8; --secondary: #cbd5e1;
    --border: rgba(255, 255, 255, 0.10); --input: #0d1424; --focus: rgba(99, 128, 255, 0.6);
    --blue: #6380ff; --blue-hover: #4f6ef7; --red: #f87171; --red-bg: rgba(239, 68, 68, 0.12); --amber: #fbbf24;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45); color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(0, 1fr); }

/* Brand panel */
.auth-brand {
    position: relative; overflow: hidden; padding: 48px 56px; color: #fff;
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
    background: radial-gradient(1200px 600px at -10% -10%, rgba(255,255,255,.18), transparent 60%),
                linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #9333ea 100%);
}
.auth-brand::after {
    content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.brand-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.brand-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.18); color: #fff; }
.brand-icon svg { width: 24px; height: 24px; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.3px; }
.brand-sub { font-size: .72rem; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; opacity: .8; }
.brand-copy { position: relative; z-index: 1; max-width: 440px; }
.brand-copy h2 { font-size: 2.1rem; line-height: 1.15; font-weight: 800; letter-spacing: -.8px; margin-bottom: 14px; }
.brand-copy p { font-size: 1rem; line-height: 1.6; opacity: .88; }
.brand-points { list-style: none; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; font-size: .9rem; opacity: .95; }
.brand-points li { display: flex; gap: 10px; align-items: center; }
.brand-points span { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.14); }

/* Form panel */
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px 24px; }
.auth-card {
    width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border); border-radius: 18px;
    padding: 36px 32px 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px;
}
.card-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.brand-icon.small { width: 44px; height: 44px; background: linear-gradient(135deg, var(--blue), var(--purple)); margin-bottom: 8px; box-shadow: 0 6px 18px rgba(79, 70, 229, .35); }
.card-head h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.4px; }
.card-head p { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: .8rem; font-weight: 700; color: var(--secondary); }
input[type=email], input[type=password], input[type=text] {
    width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--input); color: var(--text); font: inherit; font-size: .95rem; outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 15%, transparent); background: var(--card); }
input[aria-invalid="true"] { border-color: var(--red); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); background: var(--input); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-toggle .eye-off, .pw-toggle[aria-pressed="true"] .eye { display: none; }
.pw-toggle[aria-pressed="true"] .eye-off { display: block; }
.caps { color: var(--amber); font-size: .78rem; font-weight: 600; }

.remember { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--secondary); cursor: pointer; user-select: none; }
.remember input { width: 17px; height: 17px; accent-color: var(--blue); }

.submit {
    height: 48px; border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 700; font-size: .98rem; color: #fff;
    background: linear-gradient(135deg, var(--blue), #4f46e5); box-shadow: 0 6px 18px rgba(37, 99, 235, .3);
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .1s, box-shadow .15s, opacity .15s;
}
.submit:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(37, 99, 235, .4); }
.submit:active:not(:disabled) { transform: translateY(1px); }
.submit:disabled { opacity: .65; cursor: not-allowed; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; display: none; animation: spin .7s linear infinite; }
.submit.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 11px 14px; border-radius: 10px; font-size: .86rem; line-height: 1.45; background: var(--red-bg); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.alert.info { background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
[hidden] { display: none !important; }

.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .76rem; color: var(--muted); }
.secure-note svg { width: 13px; height: 13px; }
.secure-note.ok { color: var(--green); }
.foot { font-size: .76rem; color: var(--muted); text-align: center; max-width: 400px; line-height: 1.5; }
.foot code { font-size: .74rem; background: var(--input); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

/* Backend connection status */
.server-status { display: flex; align-items: center; gap: 8px; align-self: center; padding: 5px 12px; border-radius: 999px;
    font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--input); border: 1px solid var(--border); }
.server-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.server-status[data-state="checking"] .dot, .server-status[data-state="waking"] .dot { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.server-status[data-state="online"] { color: var(--green); }
.server-status[data-state="online"] .dot { background: var(--green); }
.server-status[data-state="offline"] { color: var(--red); }
.server-status[data-state="offline"] .dot { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.alert.success { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }

/* Server settings */
.link-btn { background: none; border: 0; padding: 2px 4px; color: var(--blue); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; border-radius: 4px; }
.link-btn:hover { text-decoration: underline; }
.api-panel { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.api-panel input { height: 40px; font-size: .88rem; }
.api-hint { font-size: .74rem; color: var(--muted); line-height: 1.4; }
.api-hint.error { color: var(--red); }
.api-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.small-btn, .ghost-btn { height: 34px; padding: 0 14px; border-radius: 8px; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.small-btn { border: 0; color: #fff; background: var(--blue); }
.small-btn:hover { background: var(--blue-hover); }
.ghost-btn { border: 1px solid var(--border); background: none; color: var(--secondary); }
.ghost-btn:hover { background: var(--input); }
.link-btn:focus-visible, .small-btn:focus-visible, .ghost-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

input:focus-visible, .submit:focus-visible, .pw-toggle:focus-visible, .remember input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card { padding: 28px 22px 22px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .server-status .dot { animation: none !important; } }
