/* ============================================================
   PenguBOT portal theme
   Shared by the client portal, the redeem flow, the admin
   sign-in and the error pages. Tokens: pengu-tokens.css.
   ============================================================ */

/* Legacy token names still used by page scripts and inline styles */
:root {
    --primary: var(--pb-accent);
    --primary-hover: var(--pb-accent-hover);
    --accent: var(--pb-accent);
    --primary-ring: var(--pb-accent-tint);
    --grad-brand: var(--pb-accent-tint);
    --success: var(--pb-accent);
    --warning: var(--pb-text);
    --danger: var(--pb-text);
    --info: var(--pb-text-muted);
    --bg: var(--pb-bg);
    --surface: var(--pb-surface);
    --surface-2: var(--pb-bg);
    --surface-3: var(--pb-border);
    --border: var(--pb-border);
    --border-2: var(--pb-border);
    --text-1: var(--pb-text);
    --text-2: var(--pb-text);
    --text-3: var(--pb-text-muted);
    --text-4: var(--pb-text-muted);
    --r-sm: var(--pb-radius);
    --r: var(--pb-radius);
    --r-lg: var(--pb-radius);
    --font-mono: var(--pb-mono);
    --t: var(--pb-ease);
}

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

html {
    min-height: 100%;
    background: var(--pb-bg) linear-gradient(180deg, var(--pb-bg) 0%, var(--pb-bg-end) 100%) no-repeat;
}
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: transparent;
    color: var(--pb-text);
    font-family: var(--pb-font);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Optional pitch-line texture for sign-in and landing style pages */
body.pb-pitch {
    background-image: var(--pb-pitch);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: min(1400px, 140vw) auto;
    background-attachment: fixed;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.04em; line-height: 0.95; color: var(--pb-text); }
p { margin: 0; }
b, strong { font-weight: 700; }
a { color: var(--pb-accent); text-decoration: none; transition: color var(--pb-ease); }
a:hover { color: var(--pb-accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 2px; }
::selection { background: var(--pb-accent); color: var(--pb-on-accent); }
code, kbd, pre, .mono { font-family: var(--pb-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--pb-text-muted); }
.accent { color: var(--pb-accent); }
[hidden] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: var(--pb-border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pb-border); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--pb-text-muted); background-clip: padding-box; }

/* ---------- Type ---------- */
.pb-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pb-text-muted);
}
.pb-hero {
    font-size: clamp(44px, 7vw, 88px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.95;
}
.pb-title {
    font-size: clamp(32px, 4.4vw, 48px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.95;
}
.pb-hero em, .pb-title em, h1 em, h2 em { font-style: normal; color: var(--pb-accent); }
.pb-lede { font-size: 16px; color: var(--pb-text-muted); max-width: 56ch; }

/* ---------- Layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 56px 32px 96px; }
@media (max-width: 640px) { .wrap { padding: 32px 16px 64px; } }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 72px;
    padding: 0 32px;
    background: var(--pb-bg);
    border-bottom: 1px solid var(--pb-border);
}
@media (max-width: 640px) { .topbar { padding: 0 16px; height: 64px; } }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--pb-text);
    text-decoration: none !important;
}
.brand img { width: 40px; height: 40px; display: block; flex: 0 0 auto; }
.brand .brand-name {
    display: block;
    white-space: nowrap;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--pb-text);
}
.brand .brand-sub {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pb-text-muted);
}
@media (max-width: 480px) { .brand .brand-sub { display: none; } }

.pb-nav { display: flex; align-items: center; gap: 8px; }
.pb-nav form { margin: 0; }
.pb-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    color: var(--pb-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-bottom: 1px solid transparent;
    text-decoration: none !important;
}
.pb-nav-link:hover { color: var(--pb-text); }
.pb-nav-link.active { color: var(--pb-text); }
.pb-nav-link.active .fa { color: var(--pb-accent); }
.pb-nav-link .fa { font-size: 16px; }
@media (max-width: 640px) {
    .pb-nav { gap: 4px; }
    .pb-nav-link { padding: 0 10px; }
    .pb-nav-link span, .pb-nav .btn span { display: none; }
    .pb-nav .btn { width: 36px; padding: 0; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 24px;
    border-radius: var(--pb-radius-pill);
    border: 1px solid var(--pb-border);
    background: transparent;
    color: var(--pb-text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;
    transition: color var(--pb-ease), border-color var(--pb-ease), background var(--pb-ease), opacity var(--pb-ease);
}
.btn:hover { border-color: var(--pb-text-muted); color: var(--pb-text); }
.btn .fa { font-size: 16px; }
.btn:disabled, .btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 11px; }
.btn-sm .fa { font-size: 14px; }
.btn-lg { height: 52px; padding: 0 32px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }

.btn-primary, .btn-success {
    background: var(--pb-accent-tint);
    border-color: var(--pb-accent);
    color: var(--pb-accent);
}
.btn-primary:hover, .btn-success:hover {
    border-color: var(--pb-accent-hover);
    color: var(--pb-accent-hover);
}
.btn-ghost, .btn-secondary, .btn-warning { background: transparent; border-color: var(--pb-border); color: var(--pb-text); }
.btn-ghost:hover, .btn-secondary:hover, .btn-warning:hover { border-color: var(--pb-text-muted); color: var(--pb-text); }
.btn-danger { background: transparent; border-color: var(--pb-text-muted); color: var(--pb-text); }
.btn-danger:hover { background: var(--pb-text); border-color: var(--pb-text); color: var(--pb-on-accent); }
.btn-link { height: auto; padding: 0; border: 0; background: none; color: var(--pb-accent); }
.btn-link:hover { color: var(--pb-accent-hover); text-decoration: underline !important; }

.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--pb-text-muted); cursor: pointer; }
.link-btn:hover { color: var(--pb-text); }

/* ---------- Surfaces ---------- */
.card {
    position: relative;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    box-shadow: var(--pb-shadow);
}
.card.frame::after,
.pb-frame::after {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid var(--pb-accent-line);
    border-radius: 6px;
    pointer-events: none;
}
.card-pad { padding: 32px; }
@media (max-width: 640px) { .card-pad { padding: 24px; } }
.pb-divider { height: 1px; background: var(--pb-border); border: 0; margin: 24px 0; }

@media (prefers-reduced-motion: no-preference) {
    .card { animation: pbFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
}
@keyframes pbFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Tags ---------- */
.tag, .pb-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: var(--pb-radius-pill);
    border: 1px solid var(--pb-text-muted);
    background: transparent;
    color: var(--pb-text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}
.tag-solid { background: var(--pb-text); border-color: var(--pb-text); color: var(--pb-on-accent); }
.tag-accent { background: var(--pb-accent-tint); border-color: var(--pb-accent); color: var(--pb-accent); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--pb-accent); display: inline-block; flex: 0 0 auto; }
.dot-off { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--pb-text-muted); display: inline-block; flex: 0 0 auto; }

/* ---------- Alerts ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    color: var(--pb-text);
    font-size: 14px;
    line-height: 1.5;
}
.alert > .fa { font-size: 18px; margin-top: 1px; flex: 0 0 auto; color: var(--pb-text-muted); }
.alert-success { border-color: var(--pb-accent-line); }
.alert-success > .fa { color: var(--pb-accent); }
.alert-error, .alert-danger, .alert-warning { border-color: var(--pb-text); }
.alert-error > .fa, .alert-danger > .fa, .alert-warning > .fa { color: var(--pb-text); }

.info-note {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding: 14px 16px;
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    background: var(--pb-bg);
    color: var(--pb-text-muted);
    font-size: 13px;
    line-height: 1.5;
}
.info-note > .fa { color: var(--pb-accent); font-size: 18px; flex: 0 0 auto; }

/* ---------- Forms ---------- */
.field { margin-bottom: 24px; }
.field > label, .pb-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pb-text-muted);
}
.input, .field input, .field select, .field textarea, .pb-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    color: var(--pb-text);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color var(--pb-ease), box-shadow var(--pb-ease);
}
.field textarea, textarea.input { height: auto; min-height: 112px; padding: 12px 16px; line-height: 1.5; resize: vertical; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder, .pb-input::placeholder { color: var(--pb-text-muted); opacity: 1; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .pb-input:focus {
    border-color: var(--pb-accent);
    box-shadow: var(--pb-ring);
}
.field .input-wrap { position: relative; }
.field .input-wrap > .fa {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pb-text-muted);
    font-size: 18px;
    pointer-events: none;
}
.field .input-wrap > input { padding-left: 48px; }
.field-note { margin-top: 8px; font-size: 13px; color: var(--pb-text-muted); line-height: 1.5; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--pb-text);
    -webkit-box-shadow: 0 0 0 1000px var(--pb-surface) inset;
    caret-color: var(--pb-text);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--pb-accent); }
select.input, .field select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A9FA6' stroke-width='1.85' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

/* ---------- Sign-in / onboarding shell ---------- */
.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.auth-top { display: flex; align-items: center; justify-content: space-between; padding: 32px; }
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 24px 72px;
}
.auth-card { width: 100%; max-width: 440px; padding: 40px; }
.auth-card h1 { font-size: 44px; margin: 16px 0 16px; }
.auth-sub { color: var(--pb-text-muted); font-size: 15px; margin: 0 0 32px; }
.auth-sub b { color: var(--pb-text); font-weight: 600; overflow-wrap: anywhere; }
.auth-foot .fa { font-size: 14px; vertical-align: -2px; margin-right: 4px; }
.auth-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--pb-text-muted);
    color: var(--pb-text);
    font-size: 20px;
}
.auth-foot { margin-top: 32px; text-align: center; font-size: 13px; color: var(--pb-text-muted); }
.auth-foot a { font-weight: 600; }
.auth-bottom { padding: 24px 32px 32px; font-size: 12px; color: var(--pb-text-muted); }
@media (max-width: 640px) {
    .auth-top { padding: 20px 16px; }
    .auth-main { padding: 8px 16px 48px; align-items: flex-start; }
    .auth-card { padding: 28px 24px; }
    .auth-card h1 { font-size: 36px; }
    .auth-bottom { padding: 16px; }
}
.code-input {
    width: 100%;
    height: 56px;
    padding: 0 16px;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    color: var(--pb-text);
    font-family: var(--pb-mono);
    font-size: 24px;
    letter-spacing: 0.4em;
    text-align: center;
    outline: none;
    transition: border-color var(--pb-ease), box-shadow var(--pb-ease);
}
.code-input:focus { border-color: var(--pb-accent); box-shadow: var(--pb-ring); }
.steps { display: flex; gap: 8px; margin-bottom: 32px; }
.steps .s { flex: 1; height: 2px; border-radius: 2px; background: var(--pb-border); }
.steps .s.on { background: var(--pb-accent); }
.secret-box {
    margin: 0 0 24px;
    padding: 16px;
    text-align: center;
    background: var(--pb-bg);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
}
.secret-box .pb-eyebrow { display: block; }
.secret-box .key { font-family: var(--pb-mono); font-size: 17px; font-weight: 600; letter-spacing: 0.1em; word-break: break-all; color: var(--pb-text); }
.reccodes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 24px; }
.reccodes code {
    padding: 10px 0;
    text-align: center;
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--pb-text);
    background: var(--pb-bg);
    border: 1px solid var(--pb-border);
    border-radius: 8px;
}

/* ---------- Pengu dialogs (alert / confirm / prompt / toast) ---------- */
.pengu-modal-overlay {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(17, 18, 20, 0.8);
    opacity: 0; transition: opacity 0.18s ease;
}
.pengu-modal-overlay.open { opacity: 1; }
.pengu-modal {
    width: 100%; max-width: 440px;
    padding: 32px;
    text-align: left;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    box-shadow: var(--pb-shadow);
    transform: translateY(8px);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.pengu-modal-overlay.open .pengu-modal { transform: none; }
.pengu-modal-icon {
    width: 44px; height: 44px; margin: 0 0 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 20px;
    color: var(--pb-accent);
    background: var(--pb-accent-tint);
    border: 1px solid var(--pb-accent-line);
}
.pengu-modal-icon.danger { color: var(--pb-text); background: transparent; border-color: var(--pb-text-muted); }
.pengu-modal-title { margin: 0 0 12px; font-size: 24px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; color: var(--pb-text); }
.pengu-modal-msg { font-size: 14px; line-height: 1.5; color: var(--pb-text-muted); }
.pengu-modal-msg b, .pengu-modal-msg strong, .pengu-modal-msg code { color: var(--pb-text); }
.pengu-modal-input {
    width: 100%; height: 48px; margin-top: 20px; padding: 0 16px;
    background: var(--pb-surface); color: var(--pb-text);
    border: 1px solid var(--pb-border); border-radius: var(--pb-radius);
    font-family: inherit; font-size: 15px; outline: none;
    transition: border-color var(--pb-ease), box-shadow var(--pb-ease);
}
.pengu-modal-input:focus { border-color: var(--pb-accent); box-shadow: var(--pb-ring); }
.pengu-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 32px; }
.pengu-btn {
    height: 44px; padding: 0 24px;
    border-radius: var(--pb-radius-pill);
    border: 1px solid var(--pb-border);
    background: transparent; color: var(--pb-text);
    font-family: inherit; font-size: 12px; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
    cursor: pointer;
    transition: border-color var(--pb-ease), color var(--pb-ease), background var(--pb-ease);
}
.pengu-btn-cancel:hover { border-color: var(--pb-text-muted); }
.pengu-btn-confirm { background: var(--pb-accent-tint); border-color: var(--pb-accent); color: var(--pb-accent); }
.pengu-btn-confirm:hover { border-color: var(--pb-accent-hover); color: var(--pb-accent-hover); }
.pengu-btn-confirm.pengu-danger { background: var(--pb-text); border-color: var(--pb-text); color: var(--pb-on-accent); }
.pengu-btn-confirm.pengu-danger:hover { background: var(--pb-accent-hover); border-color: var(--pb-accent-hover); }
.pengu-toast {
    position: fixed; top: 88px; right: 24px; z-index: 100001;
    display: flex; align-items: center; gap: 12px;
    max-width: 400px;
    padding: 14px 20px;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    box-shadow: var(--pb-shadow);
    color: var(--pb-text);
    font-size: 14px; font-weight: 500;
    animation: penguToastIn 0.2s ease;
}
.pengu-toast > .fa { font-size: 18px; flex: 0 0 auto; }
.pengu-toast.success { border-color: var(--pb-accent-line); }
.pengu-toast.success > .fa { color: var(--pb-accent); }
.pengu-toast.danger, .pengu-toast.warning { border-color: var(--pb-text); }
.pengu-toast.hide { opacity: 0; transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s; }
@keyframes penguToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .pengu-toast { left: 16px; right: 16px; top: 76px; max-width: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
