/* PayPal design system: PayPal-style structure, Devpost-style lists */
:root {
  --navy: #001C64; --navy-2: #003087; --blue: #0070E0; --blue-2: #005EA6; --sky: #60CDFF; --ice: #E6F0FB; --ice-2: #F1F6FD;
  --teal: #0B7C85; --teal-bg: #E3F4F5; --dp-navy: #003E54;
  --canvas: #F5F7FA; --surface: #FFFFFF; --ink: #001435; --ink-2: #2C2E2F; --muted: #545D68; --faint: #6C7378; --border: #D9DEE5; --hair: #EAEDF1;
  --ready: #16845B; --ready-bg: #E7F5EE;
  --review: #C58A2C; --review-ink: #8a5a0e; --review-bg: #FCF3E3;
  --restricted: #C34452; --restricted-bg: #FBEAEC;
  --pending-text: #64748B; --pending-bg: #F1F5F9; --pending-border: #CBD5E1; --pending-dot: #94A3B8;
  /* aliases used by the Thread and screens */
  --cobalt: var(--blue); --cobalt-2: var(--navy-2); --peri: var(--sky); --mist: var(--ice);
  --r-xl: 24px; --r: 16px; --r-s: 10px; --pill: 999px;
  --top: 72px; --ask: 400px; --max: 1240px;
  --sans: 'Inter', system-ui, sans-serif; --display: 'Manrope', 'Inter', sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --t-btn: 140ms; --t-panel: 200ms; --t-row: 160ms; --t-gate: 300ms; --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 1px 2px rgba(0, 20, 53, .06), 0 8px 24px -12px rgba(0, 20, 53, .18);
}
* { box-sizing: border-box; }
html { background: var(--surface); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.02em; line-height: 1.15; font-weight: 800; color: var(--ink); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono, code { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--pill); }
.skip:focus { left: 8px; }

/* ================= header (PayPal-style) ================= */
.hdr { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-bottom: 1px solid var(--hair); }
.hdr-in { max-width: var(--max); margin: 0 auto; height: var(--top); padding: 0 24px; display: flex; align-items: center; gap: 28px; min-width: 0; }
.brand { display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.brand img { display: block; height: 32px; width: auto; }
.nav { display: flex; align-items: stretch; gap: 4px; height: 100%; }
.nav a { position: relative; display: flex; align-items: center; padding: 0 12px; text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink-2); transition: color var(--t-btn); }
.nav a:hover { color: var(--blue); }
.nav a[aria-current=page] { color: var(--navy-2); }
.nav a[aria-current=page]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.nav .n { margin-left: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill); background: var(--restricted); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.hdr-r { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.health { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; margin-right: 6px; }
.health span { display: inline-flex; align-items: center; gap: 6px; }
.health .warn { color: var(--review-ink); }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--pending-dot); display: inline-block; }
.led.on { background: var(--ready); box-shadow: 0 0 0 3px var(--ready-bg); }
.led.off { background: var(--review); box-shadow: 0 0 0 3px var(--review-bg); }
.burger { display: none; width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.burger:hover { background: var(--canvas); }

/* ================= pills (buttons) ================= */
.pill, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 24px; border-radius: var(--pill); border: 2px solid var(--blue); background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background var(--t-btn), border-color var(--t-btn), color var(--t-btn), transform var(--t-btn); }
.pill:hover, .btn.primary:hover { background: var(--blue-2); border-color: var(--blue-2); }
.pill:active, .btn:active { transform: scale(.98); }
.pill.dark { background: var(--navy); border-color: var(--navy); }
.pill.dark:hover { background: var(--navy-2); border-color: var(--navy-2); }
.pill.ghost, .btn { background: transparent; color: var(--navy); border-color: var(--navy); }
.pill.ghost:hover, .btn:hover { background: var(--ice-2); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { background: transparent; border-color: var(--restricted); color: var(--restricted); }
.btn.danger:hover { background: var(--restricted-bg); }
.btn.quiet { border-color: transparent; color: var(--blue); padding: 0 10px; }
.btn.quiet:hover { background: var(--ice-2); }
.btn.sm, .pill.sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn:disabled, .pill:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn svg, .pill svg { width: 16px; height: 16px; }
.icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--canvas); cursor: pointer; }
.icon:hover { background: var(--ice); }
.link { color: var(--blue); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ================= inputs (PayPal-style tall fields) ================= */
input[type=text], input[type=search], select, textarea { width: 100%; height: 48px; border: 1px solid #929496; border-radius: 6px; background: var(--surface); padding: 0 14px; font-size: 15px; transition: border-color var(--t-btn), box-shadow var(--t-btn); }
input:hover, select:hover { border-color: var(--ink-2); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(0, 112, 224, .2); }
textarea { height: auto; padding: 12px 14px; font-family: var(--mono); font-size: 13px; resize: vertical; }
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 46px; border-radius: var(--pill); border-color: var(--border); background: var(--surface); }
.lbl { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ================= status ================= */
.st { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--pill); font-size: 12.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.ready, .st.SUCCESS { color: var(--ready); background: var(--ready-bg); }
.st.review, .st.UNCLAIMED, .st.ONHOLD, .st.RETURNED, .st.REFUNDED { color: var(--review-ink); background: var(--review-bg); }
.st.restricted, .st.FAILED, .st.BLOCKED, .st.DENIED, .st.REVERSED { color: var(--restricted); background: var(--restricted-bg); }
.st.pending, .st.PENDING, .st.idle { color: var(--pending-text); background: var(--pending-bg); border-color: var(--pending-border); }
.st.pending::before, .st.PENDING::before { background: var(--pending-dot); }
.st.demo { color: var(--muted); background: transparent; border: 1px dashed var(--pending-border); }
.st.demo::before { display: none; }
/* Devpost-style teal tag (time left, themes) */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 4px; font-size: 12.5px; font-weight: 600; background: var(--teal-bg); color: var(--teal); white-space: nowrap; }
.tag.navy { background: var(--ice); color: var(--navy-2); }
.tag.grey { background: var(--canvas); color: var(--muted); }
.src { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 4px; font: 700 10.5px/1 var(--sans); letter-spacing: .05em; text-transform: uppercase; background: var(--pending-bg); color: var(--pending-text); }
.src.paypal, .src.webhook { background: var(--ice); color: var(--navy-2); }
.src.demo, .src.simulated { background: var(--review-bg); color: var(--review-ink); }

/* ================= surfaces ================= */
.pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); min-width: 0; }
.pane-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 0 20px; border-bottom: 1px solid var(--hair); }
.pane-h h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.pane-h h2 .c { font: 600 13px var(--sans); color: var(--muted); letter-spacing: 0; }
.pane-b { padding: 20px; }
.empty { padding: 40px 20px; color: var(--muted); font-size: 14px; text-align: center; }
.err-box { padding: 16px; border-radius: var(--r-s); background: var(--restricted-bg); color: var(--restricted); font-size: 14px; }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--hair), #f4f6f9, var(--hair)); background-size: 200% 100%; animation: shimmer 1.2s linear 3; }
@keyframes shimmer { to { background-position: -200% 0; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0 20px; margin: 0; font-size: 14px; }
.kv dt, .kv dd { padding: 9px 0; border-top: 1px solid var(--hair); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 600; overflow-wrap: anywhere; }
.kv dd.mono { font-weight: 400; }
.kv > :nth-child(-n+2) { border-top: 0; }

/* ================= layout ================= */
.shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); background: #F2F4F7; }
.view { min-width: 0; outline: none; padding-bottom: 64px; }
/* before the first page renders, keep the footer below the fold so a reload never flashes it */
.view:empty { min-height: 100vh; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Devpost-style page band: title, intro, tabs */
.band { background: var(--surface); border-bottom: 1px solid var(--hair); }
.band .wrap { padding-top: 56px; }
.band h1 { font-size: clamp(34px, 4.2vw, 56px); letter-spacing: -.035em; line-height: 1.05; }
.band p.lead { margin-top: 14px; font-size: 18px; color: var(--muted); max-width: 760px; }
.band .facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.band .facts .tag { white-space: normal; height: auto; min-height: 26px; padding: 3px 10px; max-width: 100%; }
.tabs { display: flex; gap: 4px; margin-top: 24px; overflow-x: auto; }
.tabs a, .tabs button { position: relative; padding: 14px 16px; border: 0; background: none; font-weight: 700; font-size: 15px; color: var(--muted); text-decoration: none; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs [aria-current=page], .tabs [aria-selected=true] { color: var(--navy-2); }
.tabs [aria-current=page]::after, .tabs [aria-selected=true]::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.body { padding-top: 32px; }

/* ================= footer (PayPal-style navy) ================= */

/* ================= Ask ================= */
/* ===== PayPal AI: movable launcher + floating box ===== */
.ppfab { position: fixed; z-index: 70; left: calc(100vw - 88px); top: calc(100vh - 88px); width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; background: #003087; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 10px 28px -8px rgba(0, 48, 135, .65), 0 0 0 4px rgba(255, 255, 255, .9); transition: transform var(--t-btn) var(--ease), box-shadow var(--t-btn); display: grid; place-items: center; }
.ppfab:hover { transform: scale(1.06); box-shadow: 0 14px 32px -8px rgba(0, 48, 135, .75), 0 0 0 4px #fff; }
.ppfab:focus-visible { outline: 3px solid #0070E0; outline-offset: 4px; border-radius: 50%; }
.ppfab.dragging { cursor: grabbing; transform: scale(1.1); transition: none; }
.ppfab.on { box-shadow: 0 10px 28px -8px rgba(0, 48, 135, .65), 0 0 0 4px #0070E0; }
.ppfab-in { display: grid; place-items: center; width: 100%; height: 100%; pointer-events: none; }
/* official PayPal mark, shown in its single-colour white form on the "Pay" navy */
.ppfab img { width: 30px; height: 30px; filter: brightness(0) invert(1); pointer-events: none; }
.ask { position: fixed; z-index: 69; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: 0 28px 64px -20px rgba(0, 20, 53, .45); animation: reveal var(--t-panel) var(--ease); }
.ask-h { height: 64px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 20px; border-bottom: 1px solid var(--hair); }
.ppai { flex: 1; display: flex; align-items: flex-start; gap: 5px; margin: 0; line-height: 1; --logo: 26px; }
.ppai img { height: var(--logo); width: auto; display: block; }
/* PayPal wordmark capitals span 26.6/48 of the logo height; Manrope caps are 0.72em → font-size = logo × 0.554 / 0.72.
   The wordmark baseline sits at 37.4/48 of the logo height, so the AI baseline is aligned to that line. */
.ppai .ai { font: italic 800 calc(var(--logo) * .762)/1 var(--display); letter-spacing: -.01em; position: relative; top: calc(var(--logo) * .125); }
.ppai .ai i { font-style: italic; }
.ppai .ai-a { color: #003087; } /* the "Pay" colour of the PayPal wordmark */
.ppai .ai-i { color: #0070E0; } /* the "Pal" colour of the PayPal wordmark */
@media print { .ppfab, .ask { display: none !important; } }
.ask-b { flex: 1; overflow: auto; padding: 20px; display: grid; align-content: start; gap: 16px; }
.ask-intro { font-size: 14px; color: var(--muted); margin-top: -10px; }
.ask-hi { font: 800 19px/1.25 var(--display); color: var(--navy); }
.ask-sub { margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ask-try .ask-back { justify-self: start; border: 0; background: none; padding: 4px 0; font-weight: 700; font-size: 14px; color: var(--blue); cursor: pointer; }
.ask-topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ask-try .ask-topics button { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color var(--t-btn), background var(--t-btn); }
.ask-try .ask-topics button:hover { border-color: var(--blue); background: var(--ice-2); }
.ask-topics b { font-size: 14px; color: var(--navy); }
.ask-topics span { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.ask-log .note { color: var(--muted); }
.ask-b.chatting .ask-hi, .ask-b.chatting .ask-intro, .ask-b.chatting .ask-try { display: none; }
.ask-b.chatting .ask-more { display: inline-flex; }
.ask-more { display: none; justify-self: start; border: 0; background: none; padding: 4px 0; font-weight: 700; font-size: 14px; color: var(--blue); cursor: pointer; }
.ask-try { display: grid; gap: 8px; }
.ask-try button { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: var(--pill); padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--navy-2); cursor: pointer; transition: border-color var(--t-btn), background var(--t-btn); }
.ask-try button:hover { border-color: var(--blue); background: var(--ice-2); }
.ask-log { display: grid; gap: 16px; }
.q { justify-self: end; max-width: 90%; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 18px 18px 4px 18px; font-size: 14px; }
.a { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; animation: reveal var(--t-panel) var(--ease); }
.a section { padding: 12px 14px; border-top: 1px solid var(--hair); font-size: 14px; }
.a section:first-child { border-top: 0; }
.a .lbl { margin-bottom: 4px; }
.a .ai { background: var(--ice-2); border-left: 3px solid var(--blue); }
.a .ai .lbl { color: var(--navy-2); }
.a a { color: var(--blue); font-size: 13px; word-break: break-all; }
.ask-f { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--hair); }
.ask-f input { border-radius: var(--pill); height: 44px; }

/* ================= dialogs / toast ================= */
dialog { border: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--ink); padding: 32px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 64px -16px rgba(0, 20, 53, .45); }
dialog[open] { animation: reveal var(--t-panel) var(--ease); }
dialog::backdrop { background: rgba(0, 20, 53, .5); }
dialog h2 { font-size: 24px; margin-bottom: 10px; }
dialog p, dialog li { font-size: 15px; color: var(--ink-2); }
dialog ul { padding-left: 20px; margin: 10px 0; max-height: 240px; overflow: auto; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--navy); color: #fff; padding: 12px 20px; border-radius: var(--pill); font-size: 14px; font-weight: 600; transition: opacity var(--t-panel), transform var(--t-panel) var(--ease); z-index: 60; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--restricted); }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ================= responsive ================= */
@media (max-width: 1240px) {
}
@media (min-width: 1101px) and (max-width: 1240px) {
  .health { display: none; }
  .hdr-in { gap: 20px; }
  .nav a { padding: 0 10px; }
}
@media (max-width: 1100px) {
  .hdr-in { gap: 16px; }
  .burger { display: grid; place-items: center; }
  .nav { display: none; position: absolute; top: var(--top); left: 0; right: 0; height: auto; flex-direction: column; gap: 0; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 8px 0; }
  .hdr.open .nav { display: flex; }
  .nav a { padding: 14px 24px; font-size: 16px; }
  .nav a[aria-current=page]::after { left: 0; right: auto; top: 10px; bottom: 10px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
}
@media (max-width: 640px) {
  :root { --top: 64px; }
  .hdr-in { padding: 0 16px; }
  .health { display: none; }
  .hdr-r { gap: 8px; }
  .hdr-r .pill { height: 40px; padding: 0 16px; font-size: 14px; }
  .brand img { width: 96px; height: auto; }
  .wrap { padding: 0 16px; }
  .band .wrap { padding-top: 28px; }
  dialog { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
