/* ═══════════════════════════════════════════════════════════════════════════
   OPEN AN ACCOUNT — GLOBAL.
   Selection state uses --card-accent, set inline from the product's own colour, so the tick, the
   border and the chip all match the product pill rather than being a generic blue.
   ═══════════════════════════════════════════════════════════════════════════ */
.open-accounts,
.acct-setup {
    padding: 0.5rem 1.25rem 2rem;
}

.open-accounts__back,
.acct-setup__back {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    margin-bottom: 0.5rem;
    font-size: var(--p1-text-base);
    font-weight: 500;
    color: var(--p1-text-secondary);
    text-decoration: none;
}

.open-accounts__back:hover,
.acct-setup__back:hover { color: var(--p1-text-primary); }

.open-accounts__lede {
    margin: 0.25rem 0 1.25rem;
    font-size: var(--p1-text-md);
    line-height: 1.5;
    color: var(--p1-text-secondary);
}

.open-accounts__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.open-card {
    width: 100%;
    text-align: left;
    padding: 1rem;
    background: var(--p1-surface);
    border: 1px solid var(--p1-border);
    border-radius: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.open-card.is-selected {
    border-color: var(--card-accent);
    background: color-mix(in srgb, var(--card-accent) 7%, var(--p1-surface));
}

/* Title left, pill hard against the top-right corner. */
.open-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.open-card__name {
    font-size: var(--p1-text-base);
    font-weight: 700;
    color: var(--p1-text-primary);
}

.open-card__pill {
    flex-shrink: 0;
    font-size: var(--p1-text-2xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.1875rem 0.5rem;
    border-radius: 9999px;
}

.open-card__desc {
    margin: 0.5rem 0 0;
    font-size: var(--p1-text-sm);
    line-height: 1.5;
    color: var(--p1-text-secondary);
}

/* Chip left, tick right. margin-left:auto on the tick keeps it right-aligned even when there is
   no chip beside it. */
.open-card__foot {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.open-card__allowance {
    font-size: var(--p1-text-xs);
    font-weight: 600;
    padding: 0.1875rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--p1-surface-inner);
    color: var(--p1-text-secondary);
}

/* Empty ring when unselected; filled in the product's own colour when selected. */
.open-card__check {
    margin-left: auto;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 9999px;
    border: 1.5px solid var(--p1-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.open-card.is-selected .open-card__check {
    background: var(--card-accent);
    border-color: var(--card-accent);
}

.open-accounts__summary {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--p1-surface);
    border: 1px solid var(--p1-border);
    border-radius: 0.875rem;
}

.open-accounts__summary-label {
    font-size: var(--p1-text-2xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--p1-text-muted);
}

.open-accounts__none {
    margin-top: 0.5rem;
    font-size: var(--p1-text-sm);
    color: var(--p1-text-muted);
}

.open-accounts__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.open-accounts__chip {
    font-size: var(--p1-text-2xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.1875rem 0.5rem;
    border-radius: 9999px;
}

.open-accounts__continue,
.acct-setup__continue {
    margin-top: 1.25rem;
}

/* ── Per-account setup ── */
.acct-setup__header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: var(--p1-surface);
    border: 1px solid var(--p1-border);
    border-radius: 0.875rem;
}

.acct-setup__pill {
    flex-shrink: 0;
    font-size: var(--p1-text-2xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.1875rem 0.5rem;
    border-radius: 9999px;
}

.acct-setup__title {
    margin: 0;
    font-size: var(--p1-card-title-size);
    font-weight: var(--p1-card-title-weight);
    color: var(--p1-text-primary);
}

.acct-setup__step {
    margin-top: 0.75rem;
    font-size: var(--p1-text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--p1-text-muted);
}

.acct-setup__card {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--p1-surface);
    border: 1px solid var(--p1-border);
    border-radius: 0.875rem;
}

.acct-setup__card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.acct-setup__card-title {
    font-size: var(--p1-text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--p1-text-muted);
    margin-bottom: 0.75rem;
}

.acct-setup__card-head .acct-setup__card-title { margin-bottom: 0; }

.acct-setup__total {
    font-size: var(--p1-text-sm);
    font-weight: 700;
    color: var(--p1-text-muted);
}

.acct-setup__total.is-ok { color: var(--p1-pos); }

.acct-setup__empty,
.acct-setup__empty-funds {
    font-size: var(--p1-text-md);
    color: var(--p1-text-muted);
    margin: 0 0 0.75rem;
}

.acct-setup__block { margin-top: 0.75rem; }

.acct-setup__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ── Fields ── */
.field + .field { margin-top: 0.75rem; }

.field__label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: var(--p1-text-2xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--p1-text-muted);
}

.field__input {
    width: 100%;
    padding: 0.75rem 0.875rem;
    background: var(--p1-surface-inner);
    border: 1px solid var(--p1-border);
    border-radius: 0.75rem;
    color: var(--p1-text-primary);
    font-family: inherit;
    font-size: var(--p1-text-base);
    outline: none;
}

.field__input:focus { border-color: var(--p1-text-muted); }

.field__hint {
    margin: 0.5rem 0 0;
    font-size: var(--p1-text-xs);
    color: var(--p1-text-muted);
}

/* ── Percentage allocation ── */
.pct-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: var(--p1-surface-inner);
    border: 1px solid var(--p1-border);
    border-radius: 0.75rem;
}

.pct-field input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--p1-text-primary);
    font-family: inherit;
    font-size: var(--p1-text-2xl);
    font-weight: 700;
}

.pct-field__unit {
    font-size: var(--p1-text-lg);
    font-weight: 600;
    color: var(--p1-text-muted);
}

.pct-chips {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.pct-chip {
    padding: 0.5rem 0;
    border-radius: 0.625rem;
    border: 1px solid var(--p1-border);
    background: var(--p1-surface-inner);
    color: var(--p1-text-secondary);
    font-family: inherit;
    font-size: var(--p1-text-sm);
    font-weight: 600;
    cursor: pointer;
}

/* The active chip takes the product's accent, so it matches the pill on the same screen. */
.pct-chip.is-active {
    background: color-mix(in srgb, var(--card-accent) 18%, transparent);
    border-color: var(--card-accent);
    color: var(--card-accent);
}

/* ── Choosing the child on a Junior ISA ──
   An existing child, or a new one. The new-child form only appears once "Add a new child" is
   picked — showing both at once invited the client to re-key a child already on record. */
.child-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.child-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;
    border: 1px solid var(--p1-border);
    border-radius: 0.75rem;
    background: var(--p1-surface);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.child-choice:hover { border-color: var(--p1-text-muted); }

.child-choice.is-picked {
    border-color: var(--p1-brand-accent);
    background: color-mix(in srgb, var(--p1-brand-accent) 6%, transparent);
}

/* A real radio, not a tick — these are mutually exclusive. */
.child-choice__radio {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.0625rem;
    border: 2px solid var(--p1-border);
    border-radius: 9999px;
    background: transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.child-choice.is-picked .child-choice__radio {
    border-color: var(--p1-brand-accent);
    box-shadow: inset 0 0 0 3px var(--p1-brand-accent);
}

.child-choice__body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.child-choice__name {
    font-size: var(--p1-text-base);
    font-weight: var(--p1-weight-semibold);
    color: var(--p1-text-primary);
}

.child-choice__meta {
    font-size: var(--p1-text-sm);
    color: var(--p1-text-muted);
}

/* ═══ DESKTOP — the open-an-account flow is a form: one centred column. Additive only. ═══ */
@media (min-width: 768px) {
    .open-accounts,
    .acct-setup {
        max-width: var(--p1-page-narrow);
        margin-inline: auto;
        padding-inline: var(--p1-page-gutter);
    }
}
