/* ==========================================================================
   style2.css — Payments and Settings
   Loaded AFTER style.css: reuses its tokens (--brand, --radius-*, etc.),
   the side panel, cards, tables, badges and buttons. Only new pieces here.
   ========================================================================== */

/* style.css gives every <section> the centred flex layout of the login
   page. Cards built on <section> must opt back out of it. */
section.card {
    display: block;
}

section.card.sub-status {
    display: flex;
}

/* Flash messages sit in a column above the cards ------------------------- */

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Two-column layout (settings) -------------------------------------------- */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1.25rem;
    align-items: start;
}

/* Card buttons row --------------------------------------------------------- */

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* ==========================================================================
   Payments
   ========================================================================== */

/* Subscription status ------------------------------------------------------ */

.sub-status {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    border-left: 6px solid var(--line);
}

.sub-status.is-on {
    border-left-color: var(--ok);
}

.sub-status.is-off {
    border-left-color: var(--brand-strong);
}

.sub-status p strong {
    color: var(--text-strong);
}

.sub-dot {
    flex: none;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    background: var(--gray-border);
}

.is-on .sub-dot {
    background: var(--ok);
    box-shadow: 0 0 0 5px var(--ok-ring);
}

.is-off .sub-dot {
    background: var(--brand-strong);
    box-shadow: 0 0 0 5px var(--focus-ring);
}

/* Plan picker -------------------------------------------------------------- */

.plan-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    border: none;
}

.plan-option {
    position: relative;
    cursor: pointer;
}

/* The radio stays in the page for keyboard and screen readers; the card
   next to it is what people see and click. */
.plan-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.plan-option-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    height: 100%;
    box-sizing: border-box;
    padding: 1.1rem 1.25rem;
    background: var(--surface-alt);
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    transition:
        background-color var(--speed) var(--ease),
        border-color var(--speed) var(--ease),
        box-shadow var(--speed) var(--ease);
}

.plan-option:hover .plan-option-body {
    background: var(--surface-alt-hover);
}

.plan-option input:checked + .plan-option-body {
    background: var(--white);
    border-color: var(--brand-strong);
    box-shadow: 0 8px 20px var(--btn-glow);
}

.plan-option input:focus-visible + .plan-option-body {
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.plan-name {
    font-weight: 600;
    color: var(--text-muted);
}

.plan-option input:checked + .plan-option-body .plan-name {
    color: var(--text-strong);
}

.plan-price {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.plan-amount {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--brand-strong);
}

.plan-charged {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.plan-meta {
    font-size: 0.85rem;
    color: var(--gray);
}

/* Checkout bar ------------------------------------------------------------- */

.checkout-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.coin-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.coin {
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--dark);
    background: var(--white);
}

.checkout-msg {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--err-soft);
    color: var(--err-text);
    font-size: 0.9rem;
}

.checkout-note {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: var(--gray);
    max-width: 70ch;
}

/* Extra badge states for invoices ----------------------------------------- */

.badge-wait {
    background: var(--tint-page);
    color: var(--brand-strong);
}

.badge-warn {
    background: var(--err-soft);
    color: var(--err-text);
}

/* ==========================================================================
   Admin
   ========================================================================== */

/* Separated from the regular tabs so it reads as a different kind of page. */
.panel-item-admin {
    margin-top: 0.6rem;
    border-color: var(--nav-border);
    background-color: var(--nav-bg);
}

.back-link {
    align-self: flex-start;
}

.admin-search {
    flex: 0 1 22rem;
}

.admin-search input[type="text"] {
    min-width: 8rem;
    box-sizing: border-box;
}

.table-scroll {
    overflow-x: auto;
}

.admin-table td {
    vertical-align: top;
}

.admin-table .badge {
    margin-top: 0.3rem;
}

.badge-admin {
    background: var(--brand-strong);
    color: var(--white);
}

.plan-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.select-field {
    font: inherit;
    font-size: 0.9rem;
    min-width: 9rem;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    color: var(--text-strong);
    background-color: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23727586' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.8rem;
    transition:
        border-color var(--speed) var(--ease),
        box-shadow var(--speed) var(--ease);
}

.select-field:focus-visible {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.admin-actions {
    display: inline-flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.admin-actions form {
    margin: 0;
}

.btn-danger {
    background: var(--err-soft);
    color: var(--err-text);
    border-color: rgba(179, 38, 30, 0.25);
}

.btn-danger:hover {
    background: var(--err);
    color: var(--white);
}

/* Account generator ------------------------------------------------------- */

.gen-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.gen-form input[type="number"] {
    width: 6rem;
    box-sizing: border-box;
}

.gen-form .select-field {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    font-size: 1rem;
}

.cred-card {
    border: 2px solid var(--brand-strong);
}

.cred-card .card-note {
    margin: 0 0 1.25rem;
}

.cred-table {
    max-width: 32rem;
}

.cred-pw {
    font-weight: 700;
    letter-spacing: 0.5px;
    user-select: all;
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

/* First-login setup modal ------------------------------------------------- */

/* Same peach as the dashboard's main column (the body's --tint-page) instead
   of style.css's dark overlay. Transparent rather than --tint-page, because
   that colour is semi-transparent and would stack on top of the body's. */
.modal-overlay {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* The card now sits on peach like the dashboard cards, so use their softer shadow. */
.modal-card {
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.06),
        0 2px 10px rgba(0, 0, 0, 0.03);
}

/* style.css pads every .modal-card input; keep the hidden username field hidden. */
.modal-card input.sr-only {
    padding: 0;
    border: 0;
}

.modal-hint {
    margin-top: -0.4rem;
    font-size: 0.8rem;
    color: var(--gray);
}

/* Password reset ----------------------------------------------------------- */

/* The step list reads left to right; the current step is the loud one. */
.reset-steps {
    display: flex;
    gap: 0.5rem;
    margin: -0.5rem 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.reset-steps li {
    flex: 1;
    padding-top: 0.5rem;
    border-top: 3px solid var(--line);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
    counter-increment: step;
}

.reset-steps li::before {
    content: counter(step) ". ";
}

.reset-steps li.is-done {
    border-top-color: var(--brand);
    color: var(--text-muted);
}

.reset-steps li.is-current {
    border-top-color: var(--brand-strong);
    color: var(--brand-strong);
}

#login-form .code-input {
    text-align: center;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 1.6rem;
    letter-spacing: 0.5em;
    padding-left: 1.5em;   /* balances the trailing letter-spacing */
}

#login-form input.sr-only {
    padding: 0;
    border: 0;
}

.reset-alt {
    text-align: center;
}

/* The logo is a link on the public pages; drop the default underline. */
a.logo {
    text-decoration: none;
}

/* ==========================================================================
   Forms (settings)
   ========================================================================== */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-stack .btn {
    align-self: flex-start;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-strong);
}

.field input {
    font: inherit;
    padding: 0.7rem 1rem;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    outline: none;
    transition:
        border-color var(--speed) var(--ease),
        box-shadow var(--speed) var(--ease);
}

.field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.field-hint {
    font-size: 0.8rem;
    color: var(--gray);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .admin-search {
        flex-basis: 100%;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .plan-amount {
        font-size: 1.9rem;
    }

    .checkout-bar .btn,
    .card-actions .btn,
    .form-stack .btn {
        width: 100%;
        text-align: center;
        align-self: stretch;
    }
}
.badge-paused  { background: #fdecc8; color: #7a4b00; }
.badge-unknown { background: #e7e9ee; color: #4a5160; }
 
.card-warning { border-left: 4px solid #e0a100; }
 
.new-device-body {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}
 
.qr-box { margin: 0; text-align: center; max-width: 280px; }
.qr-box img {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;              /* scanners need a light background, even in dark mode */
    padding: 10px;
    border-radius: 8px;
    image-rendering: pixelated;
}
.qr-box figcaption { font-size: 0.85rem; margin-top: 0.5rem; }
 
.config-box { flex: 1 1 280px; min-width: 0; }
.config-text {
    overflow-x: auto;
    white-space: pre;
    font-size: 0.8rem;
    padding: 0.75rem;
    border-radius: 6px;
    background: rgba(127, 127, 127, 0.12);
}
 
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.table-scroll { overflow-x: auto; }

/* Let the hidden attribute win over any display rule above. */
[hidden] { display: none !important; }

.social-links {
    display: flex;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;   /* comfortable touch target */
    min-height: 44px;
    border-radius: 8px;
    transition: opacity 0.2s ease;
}

.social-links a:hover {
    opacity: 0.75;
}

.social-links a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.social-links img {
    display: block;
    width: 24px;
    height: 24px;
}
