/* Brand-driven colors. Defaults match the original look; applyBranding()
       overrides --accent / --btn-grad-* at runtime from the business's branding.
       Page background/text stay on the neutral light/dark system on purpose —
       overriding them from (light-only) branding would break dark mode. */
:root {
    --accent: #EE8147;
    --btn-grad-start: #d7387d;
    --btn-grad-end: #EE8147;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, sans-serif;
    background: #fff;
    color: #111;
    padding: 24px;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #111;
        color: #f5f5f5;
    }

    input {
        background: #1e1e1e;
        border-color: #333;
        color: #f5f5f5;
    }

    input:focus {
        border-color: var(--accent);
    }

    .logo-wrap {
        border-color: #333;
    }

    .btn-siwa {
        background: #fff !important;
        color: #000 !important;
        border-color: #fff !important;
    }

    .btn-siwg {
        background: #1e1e1e !important;
        color: #f5f5f5 !important;
        border-color: #333 !important;
    }

    .btn-skip {
        color: #555 !important;
    }
}

.screen {
    display: none;
    width: 100%;
    max-width: 320px;
    flex-direction: column;
    gap: 10px;
}

.screen.active {
    display: flex;
}

.logo-wrap {
    width: 100%;
    border: 1.5px dashed #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2px;
}

.logo-wrap img {
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.tagline {
    margin: 0 0 4px;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    line-height: 1.4;
}

input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input:focus {
    border-color: var(--accent);
}

button {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--btn-grad-start), var(--btn-grad-end));
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.15s;
}

button:hover {
    opacity: 0.88;
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

.btn-siwa,
.btn-siwg {
    background: #fff;
    color: #111;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 12px 14px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-siwa {
    background: #000;
    color: #fff;
    border-color: #000;
}

.btn-siwa svg,
.btn-siwg svg {
    flex-shrink: 0;
}

.btn-skip {
    background: none;
    color: #aaa;
    font-size: 0.85rem;
    padding: 6px;
}

.error-msg {
    font-size: 0.82rem;
    color: #c0392b;
    text-align: center;
    display: none;
}

.error-msg.visible {
    display: block;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}

.btn-loading>* {
    visibility: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: btn-spin 0.65s linear infinite;
}

.btn-siwg.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.12);
    border-top-color: #444;
}

/* Apple Wallet badge — follows Apple HIG */
.btn-apple-wallet {
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: block;
    transition: opacity 0.15s;
}

.btn-apple-wallet:hover {
    opacity: 0.88;
}

.btn-apple-wallet img {
    width: 75%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.btn-apple-wallet .google-wallet-dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    .btn-apple-wallet .google-wallet-light {
        display: none;
    }

    .btn-apple-wallet .google-wallet-dark {
        display: block;
    }
}

/* ── Card info (balance / number / history) ── */
.card-info {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-balance {
    font-size: 1.8rem;
    font-weight: 700;
}

.card-balance span {
    font-size: 0.9rem;
    font-weight: 400;
    color: #888;
}

.card-number {
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    color: #888;
    letter-spacing: 0.12em;
}

.txn-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.txn-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #666;
}

.txn-delta-pos {
    color: #16a34a;
    font-weight: 600;
}

.txn-delta-neg {
    color: #c0392b;
    font-weight: 600;
}

.section-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #aaa;
    margin: 8px 0 0;
}

.my-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.my-cards a {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-danger {
    background: none;
    border: 1px solid rgba(192, 57, 43, 0.35);
    color: #c0392b;
    font-size: 0.85rem;
    padding: 10px;
}

.btn-danger-link {
    background: none;
    color: #aaa;
    font-size: 0.78rem;
    padding: 4px;
}

@media (prefers-color-scheme: dark) {

    .card-info,
    .my-cards a {
        border-color: #333;
    }
}