/* =============================================
   Doorway pages (login, password reset, email verification, expired plan).
   The form is written on a page of the group's ledger book: ruled lines,
   a red margin, blue ink. Same palette as the panel and the app.
   ============================================= */

:root {
    --bg: #F4F6F9;
    --ink: #111827;
    --ink-2: #4B5565;
    --ink-3: #6B7487;
    --primary: #005EA4;
    --primary-dark: #00467B;
    --late: #BA1A1A;
    --rule: #DCE4EE;          /* ledger ruling, pale blue as on printed books */
    --margin: rgba(186, 26, 26, .28);
    --line-h: 32px;           /* every element sits on the ruling */
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 48px 16px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

.ledger-page {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: var(--line-h) 40px var(--line-h) 72px;
    background-color: #fff;
    /* Ruled lines on the 32px rhythm, and the red margin line */
    background-image:
        linear-gradient(to right, transparent 55px, var(--margin) 55px, var(--margin) 56px, transparent 56px),
        repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line-h) - 1px), var(--rule) calc(var(--line-h) - 1px), var(--rule) var(--line-h));
    /* shift the ruling up so each rule falls just under the text baseline */
    background-position: 0 0, 0 -8px;
    border: 1px solid #E2E6EC;
    border-radius: 4px;            /* paper, not a pill */
    box-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 12px 32px rgba(17, 24, 39, .06);
    line-height: var(--line-h);
}

/* The heading band at the top of a ledger page: unruled, closed off by a
   double rule whose lower line is the third ruling line. Exactly three
   lines tall (no bottom margin, which would collapse into the title's) so
   everything after it stays on the ruling. */
.ledger-brand {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    box-sizing: border-box;
    height: calc(var(--line-h) * 3);
    margin: calc(var(--line-h) * -1) -40px 0 -72px;
    padding: 0 40px 8px 72px;
    background: linear-gradient(#fff, #fff) top / 100% 88px no-repeat;
    border-radius: 4px 4px 0 0;
    font-family: 'Manrope', 'Inter', sans-serif;
    font-weight: 600; font-size: 20px; letter-spacing: -.01em; color: var(--ink);
}
.ledger-brand::after {
    content: ''; position: absolute; left: 0; right: 0; top: 84px; height: 4px;
    border-top: 1px solid #B9C7D8; border-bottom: 1px solid #B9C7D8;
}
.ledger-logo { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }

.ledger-title {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: 36px; font-weight: 600; letter-spacing: -.02em;
    line-height: calc(var(--line-h) * 2);
    margin: var(--line-h) 0 0;
    color: var(--ink);
    position: relative; top: 7px;     /* baseline onto the second rule */
}
.ledger-lede {
    margin: 0 0 var(--line-h);
    color: var(--ink-2);
    font-size: 15px;
    line-height: var(--line-h);
}

.ledger-note {
    margin: 0 0 var(--line-h);
    color: var(--ink-3);
    font-size: 14px;
    line-height: var(--line-h);
}
.ledger-note-error { color: var(--late); }

/* Account facts, one per ruled line */
.ledger-facts { display: grid; grid-template-columns: 96px 1fr; margin: 0 0 var(--line-h); }
.ledger-facts dt { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.ledger-facts dd { margin: 0; color: var(--primary-dark); font-weight: 500;
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-facts dd.late { color: var(--late); }
.ledger-submit { text-decoration: none; }

/* Fields are written on the line: no box, just the ruling underneath */
.ledger-field { margin: 0; }
.ledger-field label {
    display: block;
    height: var(--line-h);
    line-height: var(--line-h);
    font-size: 13px; font-weight: 500;
    color: var(--ink-3);
}
.ledger-field .form-control {
    height: 24px;                     /* bottom edge lands on the rule */
    padding: 0 2px;
    border: 0;
    border-bottom: 1px solid #9FB3C8;
    border-radius: 0;
    background: transparent;
    color: var(--primary-dark);       /* blue ink */
    font-size: 16px;                  /* 16px stops iOS from zooming */
    font-weight: 500;
    box-shadow: none !important;
    margin-bottom: calc(var(--line-h) + 8px);
}
/* Saved logins: keep the paper white instead of the browser's blue fill */
.ledger-field .form-control:-webkit-autofill,
.ledger-field .form-control:-webkit-autofill:hover,
.ledger-field .form-control:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 40px #fff inset !important;
    -webkit-text-fill-color: var(--primary-dark);
    caret-color: var(--primary-dark);
}
.ledger-field .form-control::placeholder { color: #A8B3C2; font-weight: 400; }
.ledger-field .form-control:focus { border-bottom: 2px solid var(--primary); background: transparent; }
.was-validated .ledger-field .form-control:invalid { border-bottom-color: var(--late); background-image: none; padding-right: 2px; }
.was-validated .ledger-field .form-control:valid { border-bottom-color: #9FB3C8; background-image: none; }
.ledger-field .invalid-feedback {
    margin: calc(var(--line-h) * -1) 0 0;
    position: relative; top: -2px;
    height: var(--line-h); line-height: var(--line-h);
    font-size: 13px; color: var(--late);
}
.was-validated .ledger-field:has(:invalid) .invalid-feedback { display: block; }

.ledger-password { position: relative; }
.ledger-password .form-control { padding-right: 36px; }
.ledger-eye {
    position: absolute; right: 0; top: 0;
    width: 32px; height: 24px;
    border: 0; background: none;
    color: var(--ink-3);
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
}
.ledger-eye:hover { color: var(--ink); }

/* The button fills exactly one ruled line and sits on the rule below it. */
.ledger-actions {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 23px 0 9px;              /* rule at +23, next at +55; 64px in all */
}
.ledger-submit {
    position: relative;
    display: inline-block;
    height: var(--line-h); line-height: var(--line-h);
    padding: 0 28px;
    border: 0; border-radius: 6px;
    background: var(--primary);
    color: #fff !important;
    font-weight: 500; font-size: 15px;
    cursor: pointer;
    transition: background-color .15s cubic-bezier(.22, 1, .36, 1), transform .1s;
}
.ledger-submit::after { content: ''; position: absolute; inset: -6px -2px; }  /* 44px touch target */
.ledger-submit:hover { background: var(--primary-dark); }
.ledger-submit:active { transform: scale(.98); }
.ledger-submit:focus-visible, .ledger-eye:focus-visible, .ledger-link:focus-visible,
.ledger-field .form-control:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ledger-link { color: var(--ink-2); font-size: 14px; line-height: var(--line-h); text-decoration: none; }
.ledger-link:hover { color: var(--primary); text-decoration: underline; }

.ledger-foot {
    margin-top: var(--line-h);
    color: var(--ink-3);
    font-size: 12px;
    line-height: var(--line-h);
}

/* Modals on doorway pages */
.modal-content { border: 0; border-radius: 12px; }
.doorway-modal { padding: 24px; }
.doorway-modal-title {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: 20px; font-weight: 600; margin: 0 0 8px;
}
.doorway-modal p { color: var(--ink-2); font-size: 14px; margin-bottom: 20px; }
.doorway-modal .ledger-submit { height: 40px; }

@media (max-width: 480px) {
    body { padding: 16px; align-items: flex-start; }
    .ledger-page { padding: var(--line-h) 20px var(--line-h) 48px; }
    .ledger-brand { margin: calc(var(--line-h) * -1) -20px 0 -48px; padding: 0 20px 0 48px; font-size: 18px; }
    .ledger-logo { width: 40px; height: 40px; }
    .ledger-page { background-image:
        linear-gradient(to right, transparent 31px, var(--margin) 31px, var(--margin) 32px, transparent 32px),
        repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line-h) - 1px), var(--rule) calc(var(--line-h) - 1px), var(--rule) var(--line-h)); }
    .ledger-title { font-size: 32px; top: 8px; }
    .ledger-actions { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 0; }
    .ledger-actions .ledger-link { margin-top: 9px; }   /* own line, on the rule */
    .ledger-submit { width: 100%; text-align: center; }
    .ledger-link { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .ledger-submit { transition: none; }
}
.ledger-foot .ledger-link { font-size: inherit; color: inherit; }
