/* ==========================================================================
   DocSider — sign-in pages design system
   Used by: find_clinic.html, clinic_login.html, platform_login.html,
            host_not_found.html, hospital_suspended.html
   No framework dependency. Contrast targets WCAG 2.1 AA.
   ========================================================================== */

:root {
    --ds-brand: #0e7490;            /* overridden per hospital on clinic_login.html */
    --ds-brand-rgb: 14, 116, 144;
    --ds-on-brand: #ffffff;
    --ds-brand-strong: #0b5c72;

    --ds-text: #0f172a;
    --ds-text-2: #334155;
    --ds-muted: #526173;            /* 6.4:1 on white */
    --ds-faint: #6b7a8c;            /* 4.6:1 on white */
    --ds-line: #e2e8f0;
    --ds-input-line: #7b8794;       /* 3.6:1 — WCAG 1.4.11 for form controls */
    --ds-surface: #ffffff;
    --ds-page: #f4f6f9;
    --ds-field: #ffffff;

    --ds-danger: #b42318;
    --ds-danger-bg: #fef3f2;
    --ds-danger-line: #fecdca;
    --ds-warn: #93370d;
    --ds-warn-bg: #fffaeb;
    --ds-warn-line: #fedf89;

    --ds-radius: 10px;
    --ds-radius-lg: 14px;
    --ds-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
    --ds-font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.ds-auth {
    margin: 0; min-height: 100vh; background: var(--ds-page); color: var(--ds-text);
    font: 400 15px/1.55 var(--ds-font); -webkit-font-smoothing: antialiased;
}
.ds-auth a { color: var(--ds-brand-strong); text-underline-offset: 2px; }
.ds-auth a:hover { color: var(--ds-text); }
.ds-sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── DocSider wordmark ─────────────────────────────────────────────────── */
.ds-auth .ds-wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ds-text); text-decoration: none; }
.ds-auth .ds-wordmark:hover { color: var(--ds-text); }
.ds-wordmark-mark { width: 34px; height: 34px; border-radius: 22%; display: block; flex-shrink: 0; }
.ds-wordmark-text { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 24px; letter-spacing: 0; line-height: 1; }
.ds-wordmark-tag {
    margin-left: 2px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--ds-line);
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ds-muted);
}

/* ── Centered layout (find hospital, platform, status pages) ───────────── */
.ds-center {
    min-height: 100vh; display: flex; flex-direction: column;
    padding: 24px 16px max(24px, env(safe-area-inset-bottom));
}
.ds-center-header { width: 100%; max-width: 1120px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: space-between; }
.ds-center-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 0; }

.ds-card {
    width: 100%; max-width: 420px; background: var(--ds-surface);
    border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow); padding: 36px 32px 28px;
}
.ds-card-wide { max-width: 480px; }

.ds-eyebrow {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ds-muted);
}
.ds-eyebrow svg { width: 14px; height: 14px; flex-shrink: 0; }
.ds-title { margin: 0 0 6px; font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
.ds-lead { margin: 0 0 24px; color: var(--ds-muted); font-size: 15px; }

/* ── Form controls ─────────────────────────────────────────────────────── */
.ds-field { margin-bottom: 18px; }
.ds-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--ds-text-2); }
.ds-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ds-hint { margin-top: 6px; font-size: 13px; color: var(--ds-faint); }

.ds-input-wrap { position: relative; display: flex; align-items: stretch; }
.ds-input {
    width: 100%; height: 44px; padding: 0 12px; font: inherit; font-size: 15px; color: var(--ds-text);
    background: var(--ds-field); border: 1px solid var(--ds-input-line); border-radius: var(--ds-radius);
    outline: none; transition: border-color .12s ease, box-shadow .12s ease;
    -webkit-appearance: none; appearance: none;
}
.ds-input::placeholder { color: #8a96a6; }
.ds-input:hover { border-color: #5b6878; }
.ds-input:focus { border-color: var(--ds-brand); box-shadow: 0 0 0 3px rgba(var(--ds-brand-rgb), .22); }
.ds-input[aria-invalid="true"] { border-color: var(--ds-danger); }
.ds-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .18); }
.ds-input.has-toggle { padding-right: 48px; }

.ds-input-group .ds-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ds-addon {
    display: flex; align-items: center; padding: 0 12px; white-space: nowrap;
    border: 1px solid var(--ds-input-line); border-left: 0;
    border-top-right-radius: var(--ds-radius); border-bottom-right-radius: var(--ds-radius);
    background: #f1f4f8; color: var(--ds-muted); font-size: 14px;
}

.ds-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--ds-muted); cursor: pointer;
}
.ds-toggle:hover { color: var(--ds-text); background: #f1f4f8; }
.ds-toggle:focus-visible { outline: 2px solid var(--ds-brand); outline-offset: 1px; }
.ds-toggle svg { width: 18px; height: 18px; }

.ds-capslock {
    display: none; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 10px;
    border-radius: 8px; background: var(--ds-warn-bg); border: 1px solid var(--ds-warn-line);
    color: var(--ds-warn); font-size: 13px; font-weight: 500;
}
.ds-capslock.is-on { display: inline-flex; }
.ds-capslock svg { width: 14px; height: 14px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.ds-btn {
    width: 100%; height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: var(--ds-radius); cursor: pointer;
    font: inherit; font-size: 15px; font-weight: 600; text-decoration: none;
    transition: background-color .12s ease, box-shadow .12s ease, filter .12s ease;
}
.ds-auth .ds-btn-primary { background: var(--ds-brand); color: var(--ds-on-brand); text-decoration: none; }
.ds-auth .ds-btn-primary:hover { filter: brightness(.94); color: var(--ds-on-brand); }
.ds-btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ds-surface), 0 0 0 5px var(--ds-brand); }
.ds-btn[disabled], .ds-btn[aria-busy="true"] { cursor: progress; opacity: .8; }
.ds-btn svg { width: 18px; height: 18px; }
.ds-spinner {
    width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
    animation: ds-spin .7s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

.ds-auth .ds-btn-secondary { background: var(--ds-surface); color: var(--ds-text); border-color: var(--ds-input-line); }
.ds-auth .ds-btn-secondary:hover { background: #f8fafc; color: var(--ds-text); }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.ds-alert {
    display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; padding: 12px 14px;
    border-radius: var(--ds-radius); font-size: 14px; line-height: 1.45;
}
.ds-alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.ds-alert-error { background: var(--ds-danger-bg); border: 1px solid var(--ds-danger-line); color: var(--ds-danger); }
.ds-alert[hidden], [hidden].ds-chip-row, .ds-auth [hidden] { display: none !important; }

/* ── Small pieces ──────────────────────────────────────────────────────── */
.ds-divider { height: 1px; background: var(--ds-line); margin: 24px 0 18px; border: 0; }
.ds-help { margin: 18px 0 0; font-size: 14px; color: var(--ds-muted); }
.ds-secure {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 12.5px; color: var(--ds-faint);
}
.ds-secure svg { width: 14px; height: 14px; }

.ds-chip-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--ds-muted); }
.ds-chip-row[hidden] { display: none; }
.ds-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
    border: 1px solid var(--ds-line); background: #f8fafc; color: var(--ds-text-2);
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.ds-chip:hover { border-color: var(--ds-input-line); background: #fff; }
.ds-chip:focus-visible { outline: 2px solid var(--ds-brand); outline-offset: 1px; }
.ds-chip-x {
    width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--ds-faint);
    cursor: pointer; font-size: 16px; line-height: 1;
}
.ds-chip-x:hover { background: #f1f4f8; color: var(--ds-text); }

.ds-status-icon {
    width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.ds-status-icon svg { width: 24px; height: 24px; }
.ds-status-icon.is-neutral { background: #f1f4f8; color: var(--ds-muted); }
.ds-status-icon.is-warn { background: var(--ds-warn-bg); color: var(--ds-warn); }

/* ── Footer ────────────────────────────────────────────────────────────── */
.ds-footer {
    width: 100%; max-width: 1120px; margin: 0 auto; padding-top: 16px;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    font-size: 13px; color: var(--ds-faint);
}
.ds-auth .ds-footer a { color: var(--ds-muted); text-decoration: none; }
.ds-auth .ds-footer a:hover { color: var(--ds-text); text-decoration: underline; }
.ds-footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* ── Platform console variant (admin.docsider.com) ─────────────────────── */
body.ds-auth.ds-console { background: #0b1220; color: #e2e8f0; }
.ds-auth.ds-console .ds-wordmark, .ds-auth.ds-console .ds-wordmark:hover { color: #f8fafc; }
.ds-console .ds-wordmark-tag { border-color: #334155; color: #cbd5e1; }
.ds-auth.ds-console .ds-footer, .ds-auth.ds-console .ds-footer a { color: #94a3b8; }
.ds-auth.ds-console .ds-footer a:hover { color: #f8fafc; }
.ds-console .ds-card { border-color: #1e293b; box-shadow: 0 24px 48px rgba(0, 0, 0, .35); }
.ds-console .ds-card { color: var(--ds-text); }
.ds-restricted {
    display: flex; gap: 10px; align-items: flex-start; margin: 0 0 22px; padding: 12px 14px;
    border-radius: var(--ds-radius); background: #f8fafc; border: 1px solid var(--ds-line);
    font-size: 13px; color: var(--ds-text-2);
}
.ds-restricted svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--ds-muted); margin-top: 1px; }

/* ── Hospital split layout (<hospital>.docsider.com/login) ─────────────── */
.ds-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 560px); }
.ds-split-brand {
    position: relative; overflow: hidden; display: flex; flex-direction: column;
    padding: 40px 48px; color: var(--ds-on-brand);
    background: linear-gradient(160deg, var(--ds-brand) 0%, var(--ds-brand-strong) 100%);
}
.ds-split-brand.has-cover { color: #fff; background-color: #0b1220; background-position: center; background-size: cover; }
.ds-split-brand.has-cover::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(2, 6, 23, .35) 0%, rgba(2, 6, 23, .40) 40%, rgba(2, 6, 23, .82) 100%);
}
.ds-split-brand > * { position: relative; }
.ds-org { display: flex; align-items: center; gap: 14px; }
.ds-org-logo, .ds-org-initial {
    width: 56px; height: 56px; flex-shrink: 0; border-radius: 12px; background: #fff;
    box-shadow: 0 4px 14px rgba(2, 6, 23, .18);
}
.ds-org-logo { padding: 6px; object-fit: contain; }
.ds-org-initial {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ds-brand); font-weight: 700; font-size: 24px;
}
.ds-org-name { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.ds-org-host { font-size: 13px; opacity: .8; }
.ds-org-tagline {
    margin: auto 0 0; padding-top: 40px; max-width: 28ch;
    font-size: clamp(24px, 2.4vw, 34px); line-height: 1.2; font-weight: 600; letter-spacing: -.02em;
}
.ds-org-contact { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14.5px; }
.ds-org-contact li { display: flex; gap: 10px; align-items: flex-start; }
.ds-org-contact svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; opacity: .85; }
.ds-org-foot { margin-top: 28px; font-size: 12.5px; opacity: .75; display: flex; align-items: center; gap: 6px; }
.ds-org-foot svg { width: 14px; height: 14px; }
.ds-push { margin-top: auto; }

.ds-split-form {
    min-width: 0; display: flex; flex-direction: column; background: var(--ds-surface);
    padding: 32px 56px max(24px, env(safe-area-inset-bottom));
}
.ds-split-form-main { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 380px; margin: 0 auto; }
.ds-split-form .ds-footer { max-width: 380px; justify-content: center; text-align: center; }

@media (max-width: 960px) {
    .ds-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .ds-split-brand { padding: 20px 20px 24px; }
    .ds-org-logo, .ds-org-initial { width: 44px; height: 44px; border-radius: 10px; }
    .ds-org-initial { font-size: 19px; }
    .ds-org-name { font-size: 17px; }
    .ds-org-tagline { margin-top: 14px; padding-top: 0; font-size: 18px; }
    .ds-org-contact { margin-top: 12px; gap: 4px; font-size: 13.5px; }
    .ds-org-contact .is-optional, .ds-org-foot { display: none; }
    .ds-split-form { padding: 28px 20px 20px; }
    .ds-split-form-main { justify-content: flex-start; max-width: 440px; }
}
@media (max-width: 480px) {
    .ds-card { padding: 28px 20px 22px; border-radius: 12px; }
    .ds-title { font-size: 22px; }
    .ds-center { padding-top: 16px; }
    .ds-center-main { padding: 16px 0; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
