/* ==========================================================================
   Client sign in — same quiet design system as the dashboards: a light
   neutral canvas, one centred card, one accent colour.
   ========================================================================== */

:root {
    --bg-body: #f5f5f7;
    --bg-surface: #ffffff;
    --bg-sunken: #f5f5f7;

    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #86868b;

    --line: rgba(0, 0, 0, 0.08);
    --line-field: #d2d2d7;

    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: rgba(0, 113, 227, 0.09);
    --accent-ring: rgba(0, 113, 227, 0.28);

    --green: #1d9a52;
    --green-soft: rgba(52, 199, 89, 0.13);
    --red: #d70015;
    --red-soft: rgba(255, 59, 48, 0.11);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 28px rgba(0, 0, 0, 0.05);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-xl: 18px;
    --radius-pill: 980px;

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] { display: none !important; }

body {
    min-height: 100vh;
    color: var(--text-primary);
    background: var(--bg-body);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.47;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    border: 0;
    background: none;
    cursor: pointer;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

svg {
    display: block;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:focus-visible {
    outline: 3px solid var(--accent-ring);
    outline-offset: 1px;
}

.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--accent);
    transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

/* Page */

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 100vh;
    padding: 40px 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.brand:hover { text-decoration: none; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(180deg, #1d1d1f, #3a3a3c);
}

.brand-mark svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
    stroke: none;
}

.auth-card {
    width: min(100%, 400px);
    padding: 30px 30px 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
    box-shadow: var(--shadow-card);
}

.steps {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    list-style: none;
}

.steps li {
    width: 22px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--line-field);
}

.steps li.is-done { background: var(--green); }
.steps li.is-current { background: var(--accent); }

.auth-header { margin-bottom: 20px; }

.auth-header h1 {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.021em;
    line-height: 1.25;
}

.auth-header p {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13.5px;
}

.auth-header .delivery-address {
    margin-top: 10px;
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: var(--bg-sunken);
    font-size: 13px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.auth-header .delivery-address:empty { display: none; }

/* Fields */

.field { margin-bottom: 16px; }

.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
}

.field input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-field);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: var(--text-muted); }

.field input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input[aria-invalid="true"] {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-soft);
}

.field .code-input {
    height: 52px;
    font-family: var(--font-mono);
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.4em;
    text-align: center;
    text-indent: 0.4em;
}

.field-hint {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12.5px;
}

.code-timer { text-align: center; }
.code-timer.is-expired { color: var(--red); }

.form-message {
    margin-bottom: 14px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 59, 48, 0.28);
    border-radius: var(--radius-sm);
    color: var(--red);
    background: var(--red-soft);
    font-size: 13px;
}

.form-message.is-success {
    border-color: rgba(52, 199, 89, 0.3);
    color: var(--green);
    background: var(--green-soft);
}

/* Buttons */

.btn-primary {
    width: 100%;
    height: 40px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--accent);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: -6px 0 16px -6px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
}

.back-button svg {
    width: 16px;
    height: 16px;
}

.back-button:hover { background: var(--accent-soft); }

.resend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.link-button {
    padding: 2px 4px;
    border-radius: 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
}

.link-button:hover:not(:disabled) { text-decoration: underline; }

.link-button:disabled {
    color: var(--text-muted);
    cursor: default;
    font-variant-numeric: tabular-nums;
}

/* Footer */

.login-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12.5px;
    text-align: center;
}

.login-footer p {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.login-footer svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 480px) {
    .login-page {
        justify-content: flex-start;
        padding-top: 32px;
    }

    .auth-card { padding: 24px 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
