/* Filest.one — shared design system.
   Palette: white, light violet, deep violet; red is reserved for errors.
   Page-specific styles live next to their pages (p2p.css, upload.css, dashboard.css). */

/* ---------- Fonts ---------- */
@font-face {
    font-family: 'ABeeZee';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/abeezee-latin-400-normal.b0a113fc172b.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'ABeeZee';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/abeezee-latin-ext-400-normal.10ce12a2beac.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'ABeeZee';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/abeezee-latin-400-italic.5bb75cc4d0a7.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
    --color-brand: #6e73f2;
    --color-brand-strong: #5b60d0;
    --color-brand-deep: #4a4fb3;
    --color-ink: #23265f;
    --color-overlay: #2f3282;
    --color-white: #ffffff;

    --color-text: #ffffff;
    --color-text-muted: rgba(255, 255, 255, 0.76);
    --color-text-subtle: rgba(255, 255, 255, 0.58);

    --color-surface: rgba(255, 255, 255, 0.10);
    --color-surface-raised: rgba(255, 255, 255, 0.16);
    --color-surface-strong: rgba(255, 255, 255, 0.24);
    --color-surface-sunken: rgba(25, 27, 92, 0.18);
    --color-border: rgba(255, 255, 255, 0.22);
    --color-border-strong: rgba(255, 255, 255, 0.5);

    --color-danger: #ff8a9a;
    --color-danger-solid: #e5484d;
    --color-danger-hover: #cf3d42;
    --color-danger-surface: rgba(229, 72, 77, 0.2);
    --color-danger-border: rgba(255, 138, 154, 0.5);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --shadow: 0 12px 32px rgba(24, 26, 90, 0.22);
    --shadow-soft: 0 4px 14px rgba(24, 26, 90, 0.16);
    --focus-ring: 0 0 0 3px rgba(255, 255, 255, 0.55);

    /* Toggle "on" state: white track, violet knob on the violet page. */
    --toggle-on-track: var(--color-white);
    --toggle-on-knob: var(--color-brand);

    --font-sans: 'ABeeZee', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

    --header-height: 74px;
    --page-width: 1200px;
    --transition: 0.18s ease;

    /* Legacy aliases kept for page templates that still reference them. */
    --bg: var(--color-brand);
    --white: var(--color-white);
    --black: var(--color-ink);
    --accent: var(--color-brand-strong);
    --dark: var(--color-overlay);
    --success: var(--color-brand-deep);
    --error: var(--color-danger-solid);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scrollbar-gutter: stable;
    scrollbar-color: rgba(255, 255, 255, 0.5) rgba(25, 27, 92, 0.2);
    scrollbar-width: thin;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-brand);
    color: var(--color-text);
    font-family: var(--font-sans);
    line-height: 1.45;
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: rgba(25, 27, 92, 0.2); }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    border: 3px solid transparent;
    border-radius: var(--radius-pill);
    background-clip: padding-box;
}

a { color: inherit; }
img, svg { display: inline-block; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

h1 {
    font-size: clamp(1.9rem, 4.5vw, 2.8rem);
    font-weight: 400;
    line-height: 1.15;
    text-align: center;
}

h2 { font-size: 1.4rem; font-weight: 400; }
h3 { font-size: 1.1rem; font-weight: 400; }

code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }

.icon {
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    vertical-align: -0.2em;
}

.icon--lg { width: 1.6em; height: 1.6em; }
.icon--xl { width: 2.75rem; height: 2.75rem; }

.icon-spin { animation: icon-spin 0.9s linear infinite; }

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

.coin-icon {
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 50%;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.hidden, [hidden] { display: none !important; }

/* ---------- Layout ---------- */
.container {
    flex: 1 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2.5rem 1.5rem 3rem;
}

/* Pages with tabs keep their heading pinned to the top so switching tabs never moves it. */
.container--top { justify-content: flex-start; }

.messages {
    width: 100%;
    max-width: 640px;
    display: grid;
    gap: 0.75rem;
}

.logo img { width: min(320px, 80vw); height: auto; }

.empty-state-card {
    display: grid;
    justify-items: center;
    gap: 0.6rem;
    padding: 2.5rem 1.5rem;
}

.empty-state-card .icon--xl { opacity: 0.55; }

.card {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--color-white);
    color: var(--color-ink);
    font-size: 1.05rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn:active { transform: translateY(0); }

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Primary actions use the default white button; there are no dark buttons. */
.btn-primary,
.btn-success {
    background: var(--color-white);
    color: var(--color-ink);
}

.btn-ghost,
.btn-secondary,
.btn-google {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-white);
}

.btn-ghost:hover,
.btn-secondary:hover,
.btn-google:hover {
    background: var(--color-surface-raised);
    border-color: var(--color-border-strong);
}

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

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

.btn-sm {
    min-height: 38px;
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
}

.btn-block { width: 100%; }

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-white);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.icon-btn:hover {
    background: var(--color-surface-raised);
    border-color: var(--color-border-strong);
}

.count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-white);
    color: var(--color-ink);
    font-size: 0.72rem;
    line-height: 19px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--color-brand);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.25rem; }

.form-group > label,
.form-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--color-white);
}

.form-control {
    width: 100%;
    min-height: 46px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-white);
    font-size: 1rem;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.form-control::placeholder { color: var(--color-text-subtle); }

.form-control:focus {
    outline: none;
    border-color: var(--color-border-strong);
    background: var(--color-surface-raised);
    box-shadow: var(--focus-ring);
}

.form-control.is-invalid { border-color: var(--color-danger-border); }

select.form-control { background-color: var(--color-overlay); }
select.form-control option { background: var(--color-white); color: var(--color-ink); }

.help-text {
    margin-top: 0.3rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.field-error,
.error-list li,
.errorlist li {
    margin-top: 0.35rem;
    color: var(--color-danger);
    font-size: 0.9rem;
    list-style: none;
}

.error-list,
.errorlist { list-style: none; }

.error-list li {
    padding: 0.55rem 0.8rem;
    border-left: 3px solid var(--color-danger-solid);
    border-radius: var(--radius-sm);
    background: var(--color-danger-surface);
    color: var(--color-white);
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.form-check-input { margin-top: 0.25rem; accent-color: var(--color-brand-deep); }
.form-check-label { color: var(--color-text-muted); font-size: 0.92rem; cursor: pointer; }
.form-check-label a { color: var(--color-white); }

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface-sunken);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--toggle-on-track);
    border-color: var(--toggle-on-track);
}

.toggle-switch input:checked + .toggle-slider::before {
    background: var(--toggle-on-knob);
    transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider { box-shadow: var(--focus-ring); }

.toggle-switch.compact { width: 44px; height: 26px; }
.toggle-switch.compact .toggle-slider::before { width: 18px; height: 18px; }
.toggle-switch.compact input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ---------- Alerts / notices ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-white);
    border-radius: var(--radius);
    background: var(--color-surface-raised);
    color: var(--color-white);
    font-size: 0.98rem;
}

.alert-error,
.alert-danger {
    border-color: var(--color-danger-border);
    border-left-color: var(--color-danger-solid);
    background: var(--color-danger-surface);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
    color: var(--color-text-muted);
    font-size: 0.92rem;
}

.notice .icon { margin-top: 0.1rem; color: var(--color-white); }

/* ---------- Hint: a "?" that explains on hover, focus or tap ---------- */
.hint {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--color-text-muted);
    cursor: help;
}

.hint:hover,
.hint:focus-visible { color: var(--color-white); background: var(--color-surface); }

.hint__bubble {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 30;
    width: max-content;
    max-width: min(280px, 80vw);
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-overlay);
    box-shadow: var(--shadow-soft);
    color: var(--color-white);
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: left;
    visibility: hidden;
    opacity: 0;
    transition: opacity var(--transition);
}

.hint:hover .hint__bubble,
.hint:focus .hint__bubble { visibility: visible; opacity: 1; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-white);
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: nowrap;
}

.badge--solid { background: var(--color-white); border-color: var(--color-white); color: var(--color-ink); }
.badge--danger { background: var(--color-danger-surface); border-color: var(--color-danger-border); }
.badge--muted { color: var(--color-text-muted); }

/* ---------- Progress ---------- */
.progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--color-surface-sunken);
}

.progress__fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--color-white);
    transition: width 0.25s ease;
}

/* ---------- File pickers and file cards (upload, P2P) ---------- */
.dropzone {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    padding: 3rem 1.5rem;
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    text-align: center;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.dropzone:hover,
.dropzone:focus-visible { background: var(--color-surface-raised); border-color: var(--color-white); }
.dropzone.is-dragover { background: var(--color-surface-strong); border-color: var(--color-white); transform: scale(1.01); }

.dropzone__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 0.4rem;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-brand-deep);
}

.dropzone__icon .icon { width: 30px; height: 30px; }
.dropzone__title { font-size: 1.2rem; font-weight: 400; }
.dropzone__error { margin-top: 0.4rem; color: var(--color-danger); }

.file-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
}

.file-card__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--color-white);
    color: var(--color-brand-deep);
}

.file-card__body { display: grid; flex: 1; gap: 0.35rem; min-width: 0; }
.file-card__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.87rem;
}

.file-card.is-error { border-color: var(--color-danger-border); }
.file-card.is-error .file-card__status { color: var(--color-danger); }
.file-card.is-done .progress { display: none; }

.link-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.4rem 0.4rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
    text-align: left;
}

.link-box code {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-box .btn.is-copied { background: var(--color-white); color: var(--color-ink); }

/* ---------- Top banner (email verification) ---------- */
.top-banner {
    background: var(--color-brand-deep);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.top-banner__inner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0.7rem 1.25rem;
}

.top-banner__text { flex: 1; }
.top-banner__text strong { display: block; font-weight: 400; }
.top-banner__text span { color: var(--color-text-muted); font-size: 0.9rem; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(110, 115, 242, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: saturate(140%) blur(12px);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: var(--page-width);
    height: var(--header-height);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* The header is sized ~15% above the base scale. */
.brand {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    margin-left: -0.4rem;
}

.brand picture { display: contents; }
.brand img { width: auto; height: 52px; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    font-size: 1.15rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover { color: var(--color-white); background: var(--color-surface); }
.nav-link.is-active { color: var(--color-white); background: var(--color-surface-raised); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 46px;
    padding: 0 0.95rem;
    font-size: 1.15rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-white);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition);
}

.balance-pill:hover { background: var(--color-surface-raised); }

.nav-toggle { display: none; }

/* Dropdowns (language, user menu) */
.dropdown { position: relative; }

.dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 46px;
    padding: 0 0.8rem;
    font-size: 1.15rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-white);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.dropdown__toggle:hover,
.dropdown.is-open .dropdown__toggle {
    background: var(--color-surface-raised);
    border-color: var(--color-border-strong);
}

.dropdown__chevron { width: 0.9em; height: 0.9em; transition: transform var(--transition); }
.dropdown.is-open .dropdown__chevron { transform: rotate(180deg); }

.dropdown__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    display: none;
    min-width: 200px;
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dropdown.is-open .dropdown__menu { display: block; }

.dropdown__header {
    padding: 0.55rem 0.7rem 0.65rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.35rem;
}

.dropdown__header strong { display: block; font-weight: 400; overflow-wrap: anywhere; }
.dropdown__header .muted { font-size: 0.85rem; }

.dropdown__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-white);
    font-size: 0.95rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.dropdown__item:hover,
.dropdown__item.is-active { background: var(--color-surface-raised); }

.dropdown__divider { height: 1px; margin: 0.35rem 0; background: var(--color-border); }
.dropdown form { margin: 0; }

/* Country flags ({% country_flag %}) */
.flag-icon {
    display: inline-block;
    width: 16px;
    height: 12px;
    margin-right: 0.4rem;
    border-radius: 2px;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.flag-icon-sm { width: 18px; height: 13px; }
.flag-icon-lg { width: 22px; height: 16px; }

.lang-flag { width: 22px; height: 16px; border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.lang-menu { min-width: 140px; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-ink);
    font-size: 0.95rem;
    text-transform: uppercase;
}

.user-menu__name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Footer ---------- */
.site-footer {
    flex-shrink: 0;
    padding: 1.5rem 1.25rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.4rem;
    margin-top: 0.75rem;
}

.site-footer a { color: var(--color-text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--color-white); text-decoration: underline; }
.site-footer__version { margin-top: 0.75rem; font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.7; }

/* ---------- Modals ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(18, 19, 60, 0.6);
    backdrop-filter: blur(3px);
}

.modal-backdrop.is-open { display: flex; }

.modal {
    width: 100%;
    max-width: 420px;
    padding: 1.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-overlay);
    box-shadow: var(--shadow);
    text-align: center;
}

.modal h3 { margin-bottom: 0.6rem; font-size: 1.35rem; }

/* Dialogs with forms read left to right. */
.modal--form { max-width: 480px; text-align: left; }
.modal--form p { margin-bottom: 0; }
.modal p { margin-bottom: 1.4rem; color: var(--color-text-muted); }

.modal__actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* ---------- Chat consent notice ---------- */
.privacy-notice {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 1300;
    display: none;
    align-items: center;
    gap: 1rem;
    width: min(720px, calc(100% - 28px));
    padding: 1rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-overlay);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
}

.privacy-notice.is-visible { display: flex; animation: notice-in 0.25s ease; }
.privacy-notice__text { flex: 1; font-size: 0.9rem; color: var(--color-text-muted); }
.privacy-notice__text a { color: var(--color-white); }

@keyframes notice-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Auth pages ---------- */
.auth-container {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

.auth-header { margin-bottom: 1.75rem; text-align: center; }
.auth-header h1 { margin-bottom: 0.5rem; }
.auth-header p { color: var(--color-text-muted); }

.auth-links {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    text-align: center;
}

.auth-links a { color: var(--color-white); }

.auth-divider {
    position: relative;
    margin: 1.5rem 0;
    text-align: center;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-border);
}

.auth-divider span {
    position: relative;
    padding: 0 0.9rem;
    background: var(--color-brand);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.btn-google svg { flex-shrink: 0; }

/* ---------- Home ---------- */
.home {
    display: grid;
    gap: 2.5rem;
    width: 100%;
    max-width: 880px;
    text-align: center;
}

/* Hero illustration (motion lives in js/home.js). Only white tints, so it stays in the palette. */
.hero-flow {
    display: block;
    width: min(540px, 100%);
    height: auto;
    margin: 0 auto 0.75rem;
    overflow: visible;
}

.hero-flow__route { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1 8; }
.hero-flow__trail { fill: none; stroke: #ffffff; stroke-width: 2.5; stroke-linecap: round; opacity: 0; }
.hero-flow__card { fill: rgba(255, 255, 255, 0.12); stroke: rgba(255, 255, 255, 0.32); stroke-width: 1.5; }
.hero-flow__person { fill: rgba(255, 255, 255, 0.92); }
.hero-flow__halo { fill: #ffffff; opacity: 0.14; }
.hero-flow__ring { fill: none; stroke: #ffffff; stroke-width: 1.5; opacity: 0; }
.hero-flow__file, .hero-flow__coin, .hero-flow__check, .hero-flow__reward { opacity: 0; }
.hero-flow__file path { fill: #ffffff; }
.hero-flow__file .hero-flow__file-fold { fill: none; stroke: var(--color-brand); stroke-width: 1.5; stroke-linejoin: round; }
.hero-flow__coin circle { fill: #ffffff; }
.hero-flow__coin text { fill: var(--color-brand); font: 600 12.5px var(--font-sans); }
.hero-flow__check circle { fill: #ffffff; }
.hero-flow__check path { fill: none; stroke: var(--color-brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero-flow__reward { fill: #ffffff; font: 17px var(--font-sans); }

.home__title { font-size: clamp(2.1rem, 5.5vw, 3.4rem); }

.home__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}


/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
    .main-nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        margin: 0;
        padding: 0.6rem 1rem 1rem;
        border-bottom: 1px solid var(--color-border);
        background: var(--color-brand);
        box-shadow: var(--shadow-soft);
    }

    .site-header.nav-open .main-nav { display: flex; }
    .nav-link { padding: 0.8rem 0.9rem; font-size: 1.05rem; }
    .nav-toggle { display: inline-flex; }
    .user-menu__name { display: none; }
}

@media (max-width: 760px) {
}

@media (max-width: 520px) {
    .dropzone { padding: 2.25rem 1rem; }
    .file-card { flex-wrap: wrap; }
    .file-card__body { flex-basis: calc(100% - 60px); }
    .site-header__inner { gap: 0.5rem; padding: 0 0.75rem; }
    .brand { margin-left: 0; }
    .brand img { width: 40px; height: 40px; }
    .icon-btn { width: 42px; height: 42px; }
    .dropdown__toggle { height: 42px; padding: 0 0.6rem; }
    .balance-pill { display: none; }
    .header-actions { gap: 0.4rem; }
    .lang-label { display: none; }
    .container { padding: 1.75rem 1rem 2.5rem; }
    .auth-container { padding: 1.5rem 1.15rem; }
    .privacy-notice { flex-direction: column; align-items: stretch; }
    .privacy-notice .btn { width: 100%; }
    .modal__actions { flex-direction: column-reverse; }
    .modal__actions .btn { width: 100%; }
}

/* "Reduce motion" (e.g. Windows with animation effects off). Transitions are switched off
   entirely: a near-zero duration still renders one frame of the start value, which made
   positioned menus flash in the top-left corner. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }

    /* A spinner is a status indicator, not decoration: keep it turning, just slower. */
    .icon-spin {
        animation-duration: 1.6s !important;
        animation-iteration-count: infinite !important;
    }
}

/* ---------- Light surfaces: menus, dialogs, hints ----------
   Pop-ups are white cards on the violet page. Inside them the colour tokens are flipped, so every
   component (buttons, inputs, icon buttons, toggles) keeps working without its own light variant. */
.modal,
.modal-content,
.dropdown__menu,
.file-action-menu-dropdown,
.custom-select__dropdown,
.hint__bubble,
.privacy-notice {
    --color-white: var(--color-ink);
    --white: var(--color-ink);
    --color-text: var(--color-ink);
    --color-text-muted: rgba(35, 38, 95, 0.68);
    --color-text-subtle: rgba(35, 38, 95, 0.5);
    --color-surface: rgba(110, 115, 242, 0.08);
    --color-surface-raised: rgba(110, 115, 242, 0.14);
    --color-surface-strong: rgba(110, 115, 242, 0.22);
    --color-surface-sunken: rgba(110, 115, 242, 0.06);
    --color-border: rgba(35, 38, 95, 0.12);
    --color-border-strong: rgba(110, 115, 242, 0.6);
    --color-danger: #d23c47;
    --color-danger-surface: rgba(229, 72, 77, 0.1);
    --color-danger-border: rgba(229, 72, 77, 0.35);
    --focus-ring: 0 0 0 3px rgba(110, 115, 242, 0.35);
    --toggle-on-track: var(--color-brand);
    --toggle-on-knob: #ffffff;
    background: #ffffff;
    color: var(--color-ink);
}

/* Main action on white: a violet button (never a dark one). */
:is(.modal, .modal-content, .privacy-notice) .btn { background: var(--color-brand); color: #ffffff; }
:is(.modal, .modal-content, .privacy-notice) .btn:hover { background: var(--color-brand-strong); }
:is(.modal, .modal-content, .privacy-notice) :is(.btn-ghost, .btn-secondary, .btn-google) {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-ink);
}
:is(.modal, .modal-content, .privacy-notice) :is(.btn-ghost, .btn-secondary, .btn-google):hover { background: var(--color-surface-raised); }
:is(.modal, .modal-content, .privacy-notice) .btn-danger { background: var(--color-danger-solid); color: #ffffff; }
:is(.modal, .modal-content, .privacy-notice) .btn-danger:hover { background: var(--color-danger-hover); }
:is(.modal, .modal-content, .privacy-notice) .icon-btn.is-copied { background: var(--color-brand); color: #ffffff; }
:is(.modal, .modal-content, .privacy-notice) :is(.modal-select, .modal-textarea) {
    background: var(--color-surface-sunken) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-ink) !important;
}
:is(.modal, .modal-content, .privacy-notice) .modal-textarea::placeholder { color: var(--color-text-subtle) !important; }
:is(.modal, .modal-content, .privacy-notice) select.form-control,
:is(.modal, .modal-content, .privacy-notice) .modal-select option { background-color: #ffffff !important; color: var(--color-ink) !important; }
.modal-content [style*="255,255,255"],
.modal-content [style*="255, 255, 255"] { color: var(--color-text-muted) !important; }

