/* Client portal sign-in (Agency/signin.php): the agency's own branded page, dark and light.
   The agency accent arrives as --as-accent* from the page; without one the page stays neutral. */

:root {
    color-scheme: dark;
    --as-bg: #070d1c;
    --as-bg-2: #0e1a33;
    --as-card: rgba(16, 27, 51, 0.88);
    --as-card-line: rgba(170, 200, 255, 0.12);
    --as-field: rgba(4, 9, 20, 0.55);
    --as-field-line: rgba(170, 200, 255, 0.16);
    --as-text: #eef2f9;
    --as-text-2: #b4c0d7;
    --as-text-3: #8693ae;
    --as-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --as-plate-dark: #0b1326;
    --as-plate-light: #ffffff;
    --as-notice-bg: rgba(255, 159, 67, 0.1);
    --as-notice-line: rgba(255, 159, 67, 0.35);
    --as-notice-ic: #ff9f43;
    --as-notice-b: #ffb067;
    --as-red: #f06a5e;
    /* neutral accent when the agency has no usable color: a white button on the dark card */
    --as-accent: #eef2f9;
    --as-accent-hi: #ffffff;
    --as-accent-ink: #0b1326;
    --as-accent-text: #eef2f9;
    --as-accent-soft: rgba(170, 200, 255, 0.08);
    --as-accent-stroke: rgba(170, 200, 255, 0.4);
}

:root[data-theme="light"] {
    color-scheme: light;
    --as-bg: #eef1f7;
    --as-bg-2: #ffffff;
    --as-card: #ffffff;
    --as-card-line: rgba(22, 36, 70, 0.1);
    --as-field: #ffffff;
    --as-field-line: rgba(22, 36, 70, 0.18);
    --as-text: #141c2e;
    --as-text-2: #3c4860;
    --as-text-3: #5e6a83;
    --as-shadow: 0 24px 60px -30px rgba(20, 30, 60, 0.35), 0 1px 2px rgba(20, 30, 60, 0.06);
    --as-notice-bg: #fff6ea;
    --as-notice-line: rgba(217, 119, 6, 0.3);
    --as-notice-ic: #c2610c;
    --as-notice-b: #9a4a06;
    --as-red: #c83a30;
    --as-accent: #141c2e;
    --as-accent-hi: #2a3550;
    --as-accent-ink: #ffffff;
    --as-accent-text: #141c2e;
    --as-accent-soft: rgba(22, 36, 70, 0.06);
    --as-accent-stroke: rgba(22, 36, 70, 0.35);
}

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

body.as-body {
    min-height: 100vh;
    font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--as-text);
    background:
        radial-gradient(60% 50% at 50% -5%, var(--as-accent-soft), transparent 70%),
        radial-gradient(120% 70% at 50% -10%, var(--as-bg-2), transparent 65%),
        var(--as-bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

.as-stage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px 24px;
}

.as-card {
    width: 100%;
    max-width: 440px;
    padding: 34px 34px 28px;
    border-radius: 20px;
    background: var(--as-card);
    border: 1px solid var(--as-card-line);
    box-shadow: var(--as-shadow);
    position: relative;
}

.as-branded .as-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 28px;
    right: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--as-accent), var(--as-accent-soft));
}

/* ---- brand: logo, or the agency name with its initials ---- */
.as-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 26px;
}

.as-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    max-width: 100%;
}

.as-logo[hidden], .as-name[hidden] { display: none; }

.as-logo img {
    display: block;
    max-width: 220px;
    max-height: 64px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.as-logo--opaque img { border-radius: 10px; }

/* light artwork needs a dark plate on the white card; dark artwork needs a white plate on the dark card */
[data-theme="light"] .as-logo--light,
[data-theme="dark"] .as-logo--dark { padding: 12px 20px; }
[data-theme="light"] .as-logo--light { background: var(--as-plate-dark); }
[data-theme="dark"] .as-logo--dark { background: var(--as-plate-light); }

.as-name {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: 'Bricolage Grotesque', 'Instrument Sans', sans-serif;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.015em;
    line-height: 1.2;
    text-align: left;
    min-width: 0;
    overflow-wrap: anywhere;
}

.as-mark {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    letter-spacing: 0.02em;
    background: var(--as-accent);
    color: var(--as-accent-ink);
}

/* ---- heading ---- */
.as-title {
    font-family: 'Bricolage Grotesque', 'Instrument Sans', sans-serif;
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-align: center;
}

.as-sub {
    margin: 8px auto 20px;
    max-width: 340px;
    text-align: center;
    color: var(--as-text-2);
    font-size: 15px;
}

.as-sub b { color: var(--as-text); }

.as-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 18px;
    padding: 10px 12px;
    border-radius: 11px;
    background: var(--as-notice-bg);
    border: 1px solid var(--as-notice-line);
    color: var(--as-text-2);
    font-size: 13.5px;
    line-height: 1.5;
}

.as-notice svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    fill: none;
    stroke: var(--as-notice-ic);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.as-notice b { color: var(--as-notice-b); font-weight: 600; }

/* flash messages (alert.css) on the light card */
[data-theme="light"] .as-card .al { background: #ffffff; box-shadow: 0 0 0 1px rgba(22, 36, 70, 0.08), 0 8px 20px -12px rgba(20, 30, 60, 0.25); }
[data-theme="light"] .as-card .al-msg { color: var(--as-text); }

/* ---- form ---- */
.as-form { display: grid; gap: 16px; }

.as-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--as-text-2);
}

.as-input { position: relative; }

.as-input > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--as-text-3);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.as-input input {
    width: 100%;
    height: 50px;
    padding: 0 46px 0 44px;
    border-radius: 12px;
    border: 1.5px solid var(--as-field-line);
    background: var(--as-field);
    color: var(--as-text);
    font: inherit;
    font-size: 16px; /* 16px keeps phones from zooming in */
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.as-input input::placeholder { color: var(--as-text-3); opacity: 1; }

.as-input input:focus {
    border-color: var(--as-accent);
    box-shadow: 0 0 0 4px var(--as-accent-soft);
}

.as-input--code input {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.35em;
}

.as-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--as-text-3);
    cursor: pointer;
}

.as-eye:hover { color: var(--as-text); }
.as-eye:focus-visible { outline: 2px solid var(--as-accent); outline-offset: 0; }

.as-eye svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.as-err { display: block; margin-top: 6px; color: var(--as-red); font-size: 13.5px; }

.as-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    flex-wrap: wrap;
    font-size: 14.5px;
}

.as-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--as-text-2);
    cursor: pointer;
    min-height: 40px;
}

.as-remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--as-accent);
}

.as-row .as-link { min-height: 40px; display: inline-flex; align-items: center; margin-left: auto; }

.as-link {
    color: var(--as-accent-text);
    font-weight: 600;
    text-decoration: none;
    text-underline-offset: 3px;
}

.as-link:hover { text-decoration: underline; }
.as-link:focus-visible { outline: 2px solid var(--as-accent); outline-offset: 2px; border-radius: 4px; }

.as-submit {
    width: 100%;
    height: 52px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    background: var(--as-accent);
    color: var(--as-accent-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 26px -14px var(--as-accent-stroke);
    transition: filter 0.15s, transform 0.15s;
}

.as-submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.as-submit:focus-visible { outline: 3px solid var(--as-accent-stroke); outline-offset: 2px; }

.as-submit svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.as-alt {
    text-align: center;
    color: var(--as-text-3);
    font-size: 14.5px;
}

.as-foot {
    margin-top: 22px;
    color: var(--as-text-3);
    font-size: 13px;
}

@media (max-width: 480px) {
    .as-stage { justify-content: flex-start; padding-top: 28px; }
    .as-card { padding: 26px 20px 22px; border-radius: 18px; }
    .as-title { font-size: 23px; }
    .as-logo img { max-width: 190px; max-height: 56px; }
}
