/* =========================================================================
   auth.css — login / first-run setup screen
   Standalone document: shares the tokens from app.css, no shell.
   ========================================================================= */

:root {
    --ink: #0f172a;
    --ink-2: #1e293b;
    --ink-3: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;

    --line: #e8ecf3;
    --line-2: #f1f5f9;

    --bg: #f6f7fb;
    --card: #ffffff;

    --brand: #ff6600;
    --brand-2: #ff8a3d;
    --brand-soft: #fff4ec;

    --green: #10b981;
    --green-soft: #ecfdf5;
    --amber: #f59e0b;
    --amber-soft: #fffbeb;
    --red: #ef4444;
    --red-soft: #fef2f2;

    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;

    --shadow-1: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow-2: 0 24px 60px -34px rgba(15, 23, 42, .34);

    --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.auth-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* soft ambient brand light */
.auth-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}
.auth-glow--one {
    width: 460px;
    height: 460px;
    top: -190px;
    right: -130px;
    background: radial-gradient(circle, rgba(255, 102, 0, .16), rgba(255, 102, 0, 0) 68%);
}
.auth-glow--two {
    width: 520px;
    height: 520px;
    bottom: -260px;
    left: -180px;
    background: radial-gradient(circle, rgba(59, 130, 246, .10), rgba(59, 130, 246, 0) 70%);
}

/* -------------------------------------------------------------------------
   Card
   ---------------------------------------------------------------------- */
.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 396px;
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 28px 26px 20px;
    box-shadow: var(--shadow-2);
    animation: authIn .34s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes authIn {
    from { opacity: 0; transform: translateY(10px) scale(.994); }
    to   { opacity: 1; transform: none; }
}

.auth-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.auth-mark {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--brand), var(--brand-2));
    box-shadow: 0 8px 18px -10px rgba(255, 102, 0, .9);
}
.auth-mark span {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .28);
}

.auth-head__text { min-width: 0; }

.auth-company {
    margin: 0;
    font-size: 1.06rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-sub {
    margin: 2px 0 0;
    font-size: .76rem;
    font-weight: 500;
    color: var(--muted);
}

/* -------------------------------------------------------------------------
   Alert
   ---------------------------------------------------------------------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 18px;
    padding: 11px 12px;
    border-radius: var(--r-sm);
    background: var(--red-soft);
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: .78rem;
    font-weight: 500;
    line-height: 1.45;
    animation: authIn .24s ease both;
}
.auth-alert svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin-top: 1px;
    color: var(--red);
}

/* -------------------------------------------------------------------------
   Form
   ---------------------------------------------------------------------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.auth-field label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--ink-3);
}

.auth-field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: .86rem;
    font-weight: 500;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.auth-field input::placeholder {
    color: var(--muted-2);
    font-weight: 400;
}

.auth-field input:hover { border-color: #dbe2ec; }

.auth-field input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, .12);
}

.auth-input-wrap { position: relative; }
.auth-input-wrap input { padding-right: 42px; }

.auth-eye {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted-2);
    cursor: pointer;
    transition: color .16s ease, background .16s ease;
}
.auth-eye:hover { color: var(--ink-3); background: var(--line-2); }
.auth-eye:focus-visible { outline: 2px solid rgba(255, 102, 0, .35); outline-offset: 1px; }
.auth-eye svg { width: 17px; height: 17px; }
.auth-eye .eye-slash { display: none; }
.auth-eye.is-visible .eye-slash { display: block; }

/* -------------------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease,
                box-shadow .16s ease, transform .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: 2px solid rgba(255, 102, 0, .4); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

.btn-primary {
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border-color: #0f172a;
    color: #fff;
    box-shadow: 0 10px 20px -14px rgba(15, 23, 42, .85);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #243349, #16233a);
}

.btn-ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--ink-3);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--line-2);
    border-color: #dbe2ec;
}

.btn-block { width: 100%; margin-top: 4px; }

.auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: 4px;
}

/* -------------------------------------------------------------------------
   Test-connection result
   ---------------------------------------------------------------------- */
.auth-test {
    padding: 10px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--line-2);
    color: var(--ink-3);
    font-size: .76rem;
    font-weight: 500;
    line-height: 1.45;
    word-break: break-word;
}
.auth-test.is-hidden { display: none; }
.auth-test.is-pending { background: var(--line-2); border-color: var(--line); color: var(--muted); }
.auth-test.is-ok      { background: var(--green-soft); border-color: #a7f3d0; color: #047857; }
.auth-test.is-err     { background: var(--red-soft);   border-color: #fecaca; color: #b91c1c; }
.auth-test.is-warn    { background: var(--amber-soft); border-color: #fde68a; color: #b45309; }

/* -------------------------------------------------------------------------
   Footer
   ---------------------------------------------------------------------- */
.auth-footer {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line-2);
    text-align: center;
    font-size: .72rem;
    font-weight: 500;
    color: var(--muted-2);
}

.auth-credit {
    display: inline-flex;
    align-items: baseline;
    margin-left: 3px;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -.01em;
    transition: opacity .16s ease;
}
.auth-credit:hover { opacity: .78; }
.auth-credit__prohori { color: var(--ink); }
.auth-credit__x { color: #2563eb; }

/* -------------------------------------------------------------------------
   Small screens
   ---------------------------------------------------------------------- */
@media (max-width: 420px) {
    body.auth-body { padding: 18px 12px; align-items: flex-start; padding-top: 8vh; }
    .auth-card { padding: 22px 18px 16px; border-radius: 18px; }
    .auth-company { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card, .auth-alert { animation: none; }
    .btn, .auth-eye, .auth-field input { transition: none; }
}
