/* Plimsoll Invoice Payment — design tokens from docs/PLAN.md / design handoff.
   Brand navy #012233 (hover #01344f), yellow #F5E003, page #eef0f3. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #012233;
    --navy-hover: #01344f;
    --yellow: #F5E003;
    --page: #eef0f3;
    --surface: #ffffff;
    --fill: #f6f8fa;
    --border-card: #e3e6ea;
    --border-input: #d7dce1;
    --divider: #eef0f3;
    --text-body: #5b6b78;
    --text-muted: #6b7783;
    --text-faint: #8a97a3;
    --text-faint2: #9aa5b0;
    --text-label: #3d4b57;
    --ok-text: #0a7d3f;
    --ok-bg: #e8f6ee;
    --err-text: #b3261e;
    --err-bg: #fdecea;
    --err-border: #f5c6c0;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--page);
    color: var(--navy);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--navy-hover); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--navy); }
input, button { font-family: inherit; }
input::placeholder { color: var(--text-faint2); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page { min-height: 100vh; display: flex; flex-direction: column; background: var(--page); }

/* ---------- Header / footer ---------- */
.site-header {
    background: #fff; border-bottom: 1px solid #e0e4e8; padding: 15px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-header__logo { display: block; line-height: 0; }
.site-header__logo img { height: 26px; width: auto; display: block; }
.site-header__right { display: flex; align-items: center; gap: 16px; }

.secure-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.ico { display: block; flex-shrink: 0; }

.site-main { flex: 1; display: flex; flex-direction: column; }

.site-footer {
    padding: 20px; text-align: center; font-size: 12px; color: var(--text-faint2);
    border-top: 1px solid #e0e4e8; background: #fff;
}
.site-footer a { color: var(--text-faint); }

/* ---------- Language selector ---------- */
.lang { position: relative; }
.lang > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    border: 1px solid var(--border-input); border-radius: 8px; padding: 6px 10px; background: #fff;
}
.lang > summary::-webkit-details-marker { display: none; }
.lang > summary:hover { border-color: var(--navy); color: var(--navy); }
.lang__caret { font-size: 10px; }
.lang__menu {
    position: absolute; right: 0; top: calc(100% + 6px); background: #fff; z-index: 40;
    border: 1px solid var(--border-card); border-radius: 10px; padding: 6px; min-width: 150px;
    box-shadow: 0 8px 30px rgba(1,34,51,.12); display: flex; flex-direction: column;
}
.lang__item { text-decoration: none; color: var(--navy); font-size: 14px; font-weight: 500; padding: 8px 10px; border-radius: 7px; }
.lang__item:hover { background: var(--fill); }
.lang__item.is-active { font-weight: 700; background: var(--fill); }

/* ---------- Shared controls ---------- */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-label); margin-bottom: 6px; }
.field-input {
    width: 100%; padding: 11px 12px; border: 1px solid var(--border-input); border-radius: 8px;
    font-size: 16px; color: var(--navy); outline: none; /* 16px avoids iOS zoom-on-focus */
}
.field-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(1,34,51,.12); }

.btn-navy {
    width: 100%; height: 46px; background: var(--navy); color: #fff; border: none; border-radius: 8px;
    font-size: 15.5px; font-weight: 700; cursor: pointer; letter-spacing: .2px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-navy:hover { background: var(--navy-hover); }
.btn-navy--pay { height: 48px; font-size: 16px; }

.btn-secondary {
    width: 100%; height: 42px; background: #fff; color: var(--navy); border: 1px solid var(--border-input);
    border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary:hover { border-color: var(--navy); background: #f8fafb; }

.error-banner {
    display: flex; gap: 9px; align-items: flex-start; padding: 11px 13px; background: var(--err-bg);
    border: 1px solid var(--err-border); border-radius: 8px; animation: fadeUp .2s ease;
}
.error-banner[hidden] { display: none; } /* author display:flex would otherwise override [hidden] */
.error-banner__bang { color: var(--err-text); font-weight: 800; line-height: 1.4; }
.error-banner__msg { color: var(--err-text); font-size: 13.8px; line-height: 1.45; font-weight: 600; }
.error-banner__code { color: #c0736d; font-size: 11.5px; margin-top: 3px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- Lookup ---------- */
.lookup { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 56px 20px 60px; animation: fadeIn .25s ease; }
.lookup__col { width: 100%; max-width: 440px; }
.lookup__head { text-align: center; margin-bottom: 28px; }
.lookup__head img { height: 34px; width: auto; margin: 0 auto 20px; display: block; }
.lookup__head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.6px; margin-bottom: 8px; }
.lookup__head p { font-size: 15px; color: var(--text-body); line-height: 1.5; }
.lookup__card { background: #fff; border: 1px solid var(--border-card); border-radius: 14px; padding: 26px 24px; box-shadow: 0 8px 30px rgba(1,34,51,.07); }
.lookup__card .error-banner { margin-top: 14px; }
.lookup__card .btn-navy { margin-top: 20px; }

/* ---------- Invoice sheet ---------- */
.invoice { flex: 1; padding: 32px 20px 56px; animation: fadeIn .25s ease; }
.sheet {
    max-width: 1060px; margin: 0 auto; display: grid; grid-template-columns: 1.35fr 1fr; background: #fff;
    border: 1px solid var(--border-card); border-radius: 16px; overflow: hidden; box-shadow: 0 12px 44px rgba(1,34,51,.09);
}
.sheet__left { padding: 36px 38px 30px; border-right: 1px solid var(--divider); }
.sheet__right { padding: 36px 38px; }

.back-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; color: var(--text-muted); font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 22px; text-decoration: none; }
.back-btn:hover { color: var(--navy); }
.back-btn__arrow { font-size: 16px; line-height: 1; }

.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand-row img { height: 20px; width: auto; }
.chip { font-size: 11px; font-weight: 700; letter-spacing: .4px; color: var(--text-body); background: var(--divider); padding: 3px 8px; border-radius: 5px; text-transform: uppercase; }

.status-label { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.amount { font-size: 40px; font-weight: 800; letter-spacing: -1.2px; margin-bottom: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; margin-bottom: 26px; }
.status-pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.items { display: flex; flex-direction: column; gap: 16px; }
.item { display: flex; gap: 13px; align-items: flex-start; }
.item__main { flex: 1; min-width: 0; }
.item__name { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--navy); }
.item__meta { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.item__amount { font-size: 14.5px; font-weight: 600; white-space: nowrap; }

.totals { border-top: 1px solid var(--divider); margin-top: 22px; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.totals__row { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-body); }
.totals__row span:last-child { color: var(--navy); }
.total-due { border-top: 1px solid var(--border-input); margin-top: 14px; padding-top: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.total-due__label { font-size: 15px; font-weight: 700; }
.total-due__amount { font-size: 19px; font-weight: 800; }

.meta-grid { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--divider); display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint2); font-weight: 700; margin-bottom: 3px; }
.meta-value { font-size: 13.5px; font-weight: 600; }
.meta-grid__full { grid-column: 1 / -1; }

.trust-line { max-width: 1060px; margin: 16px auto 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--text-faint2); }

/* ---------- Right panel: payable ---------- */
.wallets { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
#express-checkout-element:empty { display: none; }
.btn-apple { width: 100%; height: 46px; background: #000; color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; }
.btn-apple:hover { opacity: .88; }
.btn-google { width: 100%; height: 46px; background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-google:hover { background: #f8f9fa; }
.g-blue { color: #4285F4; } .g-red { color: #EA4335; } .g-yellow { color: #FBBC05; } .g-green { color: #34A853; }

.or-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 20px; }
.or-divider__line { flex: 1; height: 1px; background: var(--border-card); }
.or-divider span { font-size: 12.5px; color: var(--text-faint2); }

.card-box { border: 1px solid var(--border-input); border-radius: 8px; overflow: hidden; background: #fff; }
.pe-mount { padding: 12px; min-height: 44px; }
.pe-mount--placeholder { color: var(--text-faint2); font-size: 12.5px; padding: 16px 12px; text-align: center; }

.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; color: var(--text-faint2); font-size: 12px; }

.pay-form .field-input { margin-bottom: 16px; }
.pay-form .error-banner { margin-top: 16px; }
.pay-form .btn-navy--pay { margin-top: 20px; }
.right-download { margin-top: 16px; }

/* ---------- Right panel: paid ---------- */
.paid { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 12px; }
.check-circle { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-bg); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.check-circle__tick { color: var(--ok-text); font-size: 30px; font-weight: 800; line-height: 1; }
.paid h2 { font-size: 21px; font-weight: 800; margin-bottom: 8px; }
.paid p { font-size: 14.5px; color: var(--text-body); line-height: 1.5; max-width: 300px; }
.receipt-row { width: 100%; background: var(--fill); border: 1px solid var(--divider); border-radius: 10px; padding: 14px 16px; margin-top: 22px; display: flex; justify-content: space-between; font-size: 13.5px; }
.receipt-row span:first-child { color: var(--text-muted); }
.receipt-row span:last-child { font-weight: 600; }
.paid .btn-navy { margin-top: 16px; }
.paid__support { font-size: 12.5px; color: var(--text-faint2); margin-top: 16px; line-height: 1.5; }

/* ---------- Success ---------- */
.success { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 56px 20px 60px; animation: fadeIn .3s ease; }
.success__card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--border-card); border-radius: 16px; padding: 40px 36px; box-shadow: 0 12px 44px rgba(1,34,51,.09); text-align: center; }
.check-circle--lg { width: 66px; height: 66px; margin: 0 auto 20px; animation: fadeUp .4s ease; }
.check-circle--lg .check-circle__tick { font-size: 34px; }
.success__card h1 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 8px; }
.success__card > p { font-size: 15px; color: var(--text-body); line-height: 1.5; margin-bottom: 24px; }
.summary-box { background: var(--fill); border: 1px solid var(--divider); border-radius: 12px; padding: 18px 20px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.summary-box__row { display: flex; justify-content: space-between; font-size: 13.5px; }
.summary-box__row span:first-child { color: var(--text-muted); }
.summary-box__row span:last-child { font-weight: 600; }
.summary-box__receipt { border-top: 1px solid #e6eaee; padding-top: 12px; display: flex; gap: 9px; align-items: flex-start; }
.summary-box__receipt .env { color: var(--ok-text); font-size: 15px; line-height: 1.3; }
.summary-box__receipt span { font-size: 13px; color: var(--text-body); line-height: 1.45; }
.success__card .btn-navy { margin-top: 20px; }
.link-btn { width: 100%; margin-top: 10px; height: 42px; background: none; color: var(--text-muted); border: none; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.link-btn:hover { color: var(--navy); }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(1,34,51,.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 60; animation: fadeIn .2s ease; }
.overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 14px; padding: 32px 40px; display: flex; flex-direction: column; align-items: center; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border-card); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
.modal__title { font-size: 15px; font-weight: 600; color: var(--navy); }
.modal__hint { font-size: 12.5px; color: var(--text-faint2); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 600; box-shadow: 0 12px 30px rgba(1,34,51,.3); z-index: 70; display: flex; align-items: center; gap: 9px; animation: fadeUp .25s ease; }
.toast[hidden] { display: none; }
.toast__spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: var(--yellow); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    /* Sheet collapses to a single column; the summary stacks above the payment panel. */
    .sheet { grid-template-columns: 1fr; }
    .sheet__left { border-right: none; border-bottom: 1px solid var(--divider); padding: 28px 22px 24px; }
    .sheet__right { padding: 26px 22px; }
    .invoice { padding: 20px 14px 40px; }
    .amount { font-size: 34px; letter-spacing: -0.8px; }
    .lookup { padding: 40px 16px 48px; }
    .success { padding: 40px 16px 48px; }
    .success__card { padding: 32px 24px; }
    .site-header { padding: 13px 16px; }
    .site-header__logo img { height: 22px; }
}

@media (max-width: 420px) {
    /* Small phones: hide the secure badge (footer already carries the security note). */
    .secure-badge { display: none; }
    .site-header__right { gap: 10px; }
    .lang > summary { padding: 6px 8px; }
    .meta-grid { gap: 12px 14px; }
    .amount { font-size: 30px; }
    .lookup__head h1 { font-size: 23px; }
}
