/* =========================================================
   RoyalGamers Cloud – einheitliches Login-Design
   Light + Dark Mode
   ========================================================= */

:root {
    color-scheme: light;
    --rg-bg: #eef8fc;
    --rg-bg-2: #f8fbff;
    --rg-surface: rgba(255,255,255,.82);
    --rg-surface-strong: rgba(255,255,255,.96);
    --rg-surface-soft: rgba(240,249,255,.82);
    --rg-border: rgba(14,165,233,.18);
    --rg-border-strong: rgba(14,165,233,.32);
    --rg-text: #102033;
    --rg-heading: #071524;
    --rg-muted: #60758d;
    --rg-accent: #00c8ed;
    --rg-accent-2: #0a83d8;
    --rg-accent-3: #2563eb;
    --rg-accent-soft: rgba(0,190,231,.10);
    --rg-success: #059669;
    --rg-warning: #d97706;
    --rg-danger: #dc2626;
    --rg-shadow: 0 22px 60px rgba(29,78,116,.12);
    --rg-shadow-soft: 0 8px 28px rgba(29,78,116,.08);
    --rg-input: rgba(255,255,255,.92);
    --rg-grid: rgba(14,165,233,.055);
    --rg-sidebar: rgba(252,254,255,.88);
    --rg-topbar: rgba(255,255,255,.72);
}

body.dark,
body.theme-dark,
html.dark body {
    color-scheme: dark;
    --rg-bg: #030912;
    --rg-bg-2: #07111f;
    --rg-surface: rgba(8,18,32,.88);
    --rg-surface-strong: rgba(8,18,32,.96);
    --rg-surface-soft: rgba(12,27,47,.82);
    --rg-border: rgba(96,165,250,.18);
    --rg-border-strong: rgba(56,200,240,.34);
    --rg-text: #e5eef9;
    --rg-heading: #f8fbff;
    --rg-muted: #9fb2c8;
    --rg-accent: #00c8ed;
    --rg-accent-2: #0a83d8;
    --rg-accent-3: #38bdf8;
    --rg-accent-soft: rgba(0,189,231,.11);
    --rg-success: #34d399;
    --rg-warning: #fbbf24;
    --rg-danger: #f87171;
    --rg-shadow: 0 24px 70px rgba(0,0,0,.42);
    --rg-shadow-soft: 0 10px 32px rgba(0,0,0,.24);
    --rg-input: rgba(7,17,31,.92);
    --rg-grid: rgba(14,165,233,.04);
    --rg-sidebar: rgba(5,14,27,.91);
    --rg-topbar: rgba(5,14,27,.78);
}

@media (prefers-color-scheme: dark) {
    body:not(.light):not(.dark):not(.theme-light):not(.theme-dark) {
        color-scheme: dark;
        --rg-bg: #030912;
        --rg-bg-2: #07111f;
        --rg-surface: rgba(8,18,32,.88);
        --rg-surface-strong: rgba(8,18,32,.96);
        --rg-surface-soft: rgba(12,27,47,.82);
        --rg-border: rgba(96,165,250,.18);
        --rg-border-strong: rgba(56,200,240,.34);
        --rg-text: #e5eef9;
        --rg-heading: #f8fbff;
        --rg-muted: #9fb2c8;
        --rg-accent: #00c8ed;
        --rg-accent-2: #0a83d8;
        --rg-accent-3: #38bdf8;
        --rg-accent-soft: rgba(0,189,231,.11);
        --rg-success: #34d399;
        --rg-warning: #fbbf24;
        --rg-danger: #f87171;
        --rg-shadow: 0 24px 70px rgba(0,0,0,.42);
        --rg-shadow-soft: 0 10px 32px rgba(0,0,0,.24);
        --rg-input: rgba(7,17,31,.92);
        --rg-grid: rgba(14,165,233,.04);
        --rg-sidebar: rgba(5,14,27,.91);
        --rg-topbar: rgba(5,14,27,.78);
    }
}

html, body { min-height: 100%; }

body {
    background:
        radial-gradient(circle at 50% 10%, rgba(0,190,255,.16), transparent 34%),
        radial-gradient(circle at 100% 80%, rgba(10,131,216,.10), transparent 28%),
        linear-gradient(145deg, var(--rg-bg), var(--rg-bg-2)) !important;
    color: var(--rg-text) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif !important;
    background-attachment: fixed !important;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(var(--rg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--rg-grid) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.9) 52%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.9) 52%, transparent 100%);
}

body::after {
    content: "";
    position: fixed;
    width: min(620px, 62vw);
    height: min(620px, 62vw);
    right: -130px;
    bottom: -160px;
    z-index: -1;
    pointer-events: none;
    background: url('assets/royalgamers-cloud-logo.png') center / contain no-repeat;
    opacity: .022;
    filter: saturate(1.1);
}
body.dark::after, body.theme-dark::after { opacity: .035; }

/* ---------- Grundtypografie ---------- */
a { color: var(--rg-accent-3); }
h1, h2, h3, h4, strong, .page-title { color: var(--rg-heading) !important; }
.page-subtitle, .user, .description, .form-help, .password-hint, .account-hint,
.payment-note, .plan-slug, .share-date, .file-count { color: var(--rg-muted) !important; }

/* ---------- App Shell ---------- */
.app { position: relative; }
.sidebar {
    background: var(--rg-sidebar) !important;
    border-right: 1px solid var(--rg-border) !important;
    box-shadow: 12px 0 40px rgba(10,131,216,.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.logo {
    color: var(--rg-heading) !important;
    padding: 8px 6px 18px;
    border-bottom: 1px solid var(--rg-border);
}
.logo .brand-mark {
    width: 52px !important;
    height: 52px !important;
    border-radius: 14px;
    filter: drop-shadow(0 8px 20px rgba(0,191,255,.25)) !important;
}
.logo .brand-title { color: var(--rg-heading) !important; font-weight: 750; }
.logo .brand-title strong {
    color: var(--rg-accent) !important;
    text-shadow: 0 0 20px rgba(0,200,237,.16);
}

.nav { gap: 7px !important; }
.nav a {
    color: var(--rg-text) !important;
    border: 1px solid transparent;
    border-radius: 11px !important;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease !important;
}
.nav a:hover {
    background: var(--rg-accent-soft) !important;
    border-color: var(--rg-border) !important;
    color: var(--rg-heading) !important;
    transform: translateX(2px);
}
.nav a.active,
.admin-nav-link.active {
    background: linear-gradient(135deg, rgba(0,200,237,.17), rgba(10,131,216,.10)) !important;
    border-color: var(--rg-border-strong) !important;
    color: var(--rg-accent-3) !important;
    box-shadow: inset 3px 0 0 var(--rg-accent);
}
.nav-divider { background: var(--rg-border) !important; }
.admin-nav-link { background: var(--rg-surface-soft) !important; border-color: var(--rg-border) !important; }

.topbar {
    background: var(--rg-topbar) !important;
    border-bottom: 1px solid var(--rg-border) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 35px rgba(10,131,216,.045);
}
.content { max-width: 1280px !important; }

/* ---------- Karten / Panels ---------- */
.card,
.folder-card,
.share-card,
.admin-stat-card,
.admin-detail-card,
.admin-storage-card,
.plan-card,
.account-card,
.payment-current-card,
.payment-pending-card,
.payment-account-review-card,
.payment-admin-warning,
.payment-rule-note,
.storage-widget,
.share-box,
.owner-section {
    background: var(--rg-surface) !important;
    border: 1px solid var(--rg-border) !important;
    box-shadow: var(--rg-shadow-soft) !important;
    /* v22: Karten bleiben deckend; per-card backdrop blur war auf vielen
       Elementen unnötig teuer und machte Scroll/Hover auf schwächeren Clients träge. */
}

.card:hover,
.folder-card:hover,
.share-card:hover,
.plan-card:hover {
    border-color: var(--rg-border-strong) !important;
}

.folder-card {
    border-radius: 14px !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease !important;
}
.folder-card:hover { transform: translateY(-2px); box-shadow: var(--rg-shadow) !important; }
.folder-icon, .file-type-icon, .admin-stat-icon, .admin-detail-icon, .share-stat-icon {
    filter: drop-shadow(0 5px 12px rgba(0,190,231,.12));
}

/* ---------- Buttons ---------- */
.button,
.submit-button,
.share-open-button,
.copy-button,
.share-copy-button,
.download-button,
.share-activate-button {
    background: linear-gradient(135deg, var(--rg-accent), var(--rg-accent-2)) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 24px rgba(0,174,225,.16) !important;
    font-weight: 700 !important;
}
.button:hover,
.submit-button:hover,
.share-open-button:hover,
.copy-button:hover,
.share-copy-button:hover,
.download-button:hover,
.share-activate-button:hover {
    background: linear-gradient(135deg, #18d8f6, #137fca) !important;
    box-shadow: 0 15px 28px rgba(0,174,225,.23) !important;
    transform: translateY(-1px);
    text-decoration: none !important;
}
.button.secondary,
.button-secondary,
.back-link,
.share-disable-button {
    background: var(--rg-surface-soft) !important;
    color: var(--rg-text) !important;
    border: 1px solid var(--rg-border) !important;
    box-shadow: none !important;
}
.button.secondary:hover,
.button-secondary:hover,
.back-link:hover,
.share-disable-button:hover {
    background: var(--rg-accent-soft) !important;
    color: var(--rg-heading) !important;
    border-color: var(--rg-border-strong) !important;
}
.button.danger,
.button-danger,
.delete-button,
.share-delete-button {
    background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
    color: #fff !important;
    border-color: rgba(248,113,113,.25) !important;
}

/* ---------- Formulare ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="file"],
select, textarea, .share-link-input, .folder-select {
    background: var(--rg-input) !important;
    border: 1px solid var(--rg-border) !important;
    color: var(--rg-text) !important;
    border-radius: 10px !important;
    outline: none !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
input::placeholder, textarea::placeholder { color: var(--rg-muted) !important; opacity: .72; }
input:focus, select:focus, textarea:focus, .share-link-input:focus {
    border-color: var(--rg-accent) !important;
    box-shadow: 0 0 0 3px rgba(0,189,231,.13) !important;
}
.form-label, .form-group label { color: var(--rg-heading) !important; }

/* ---------- Tabellen ---------- */
.file-table,
.admin-user-table-wrapper,
.payment-table { border-radius: 14px; overflow: hidden; }
.file-table table,
.admin-user-table-wrapper table,
.payment-table { background: transparent !important; }
.file-table th,
.admin-user-table-wrapper th,
.payment-table th {
    background: var(--rg-surface-soft) !important;
    color: var(--rg-muted) !important;
    border-color: var(--rg-border) !important;
    text-transform: uppercase;
    letter-spacing: .045em;
    font-size: 11px;
}
.file-table td,
.admin-user-table-wrapper td,
.payment-table td {
    background: rgba(255,255,255,.02) !important;
    border-color: var(--rg-border) !important;
    color: var(--rg-text) !important;
}
.file-table tr:hover td,
.admin-user-table-wrapper tr:hover td,
.payment-table tr:hover td { background: var(--rg-accent-soft) !important; }
.file-name { color: var(--rg-heading) !important; }

/* ---------- Storage / Fortschritt ---------- */
.storage-bar, .admin-storage-bar, .admin-user-storage-bar {
    background: color-mix(in srgb, var(--rg-muted) 16%, transparent) !important;
    border: 1px solid var(--rg-border) !important;
    overflow: hidden;
}
.storage-bar > div,
.admin-storage-bar-fill,
.admin-user-storage-fill {
    background: linear-gradient(90deg, var(--rg-accent), var(--rg-accent-2)) !important;
    box-shadow: 0 0 20px rgba(0,200,237,.22);
}
.storage-percent, .admin-storage-info, .admin-user-storage-text { color: var(--rg-muted) !important; }

/* ---------- Hinweise / Status ---------- */
.message, .message-error, .move-file-error {
    background: rgba(220,38,38,.09) !important;
    color: color-mix(in srgb, var(--rg-danger) 85%, var(--rg-heading)) !important;
    border: 1px solid rgba(248,113,113,.32) !important;
    border-radius: 10px !important;
}
.message-success, .success {
    background: rgba(5,150,105,.10) !important;
    color: color-mix(in srgb, var(--rg-success) 85%, var(--rg-heading)) !important;
    border-color: rgba(52,211,153,.32) !important;
}
.status-badge, .plan-badge, .user-badge, .admin-badge, .payment-status {
    border: 1px solid var(--rg-border) !important;
    box-shadow: none !important;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle,
.auth-theme-toggle {
    width: 42px !important;
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    border-radius: 12px !important;
    border: 1px solid var(--rg-border) !important;
    background: var(--rg-surface-soft) !important;
    color: var(--rg-heading) !important;
    box-shadow: var(--rg-shadow-soft) !important;
    cursor: pointer;
}
.theme-toggle:hover, .auth-theme-toggle:hover {
    border-color: var(--rg-border-strong) !important;
    background: var(--rg-accent-soft) !important;
    transform: translateY(-1px);
}

/* =========================================================
   Auth – exakt derselbe Look in Light + Dark
   ========================================================= */
body.auth-page {
    min-height: 100vh;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 28px 18px !important;
}
body.auth-page::after {
    width: min(740px, 74vw);
    height: min(740px, 74vw);
    right: 50%;
    bottom: 50%;
    transform: translate(50%, 50%);
    opacity: .026;
}
body.auth-page.dark::after { opacity: .04; }
.login-wrapper, .register-wrapper, .auth-wrapper {
    position: relative;
    z-index: 2;
    width: 100% !important;
    max-width: 440px !important;
}
.auth-page .brand { margin-bottom: 22px !important; text-align: center; }
.auth-page .auth-logo {
    width: 122px !important;
    height: 96px !important;
    object-fit: contain;
    margin: 0 auto 9px !important;
    filter: drop-shadow(0 12px 30px rgba(0,191,255,.25)) !important;
}
.auth-page .brand h1 { color: var(--rg-heading) !important; font-size: 29px !important; letter-spacing: -.025em; }
.auth-page .brand p { color: var(--rg-muted) !important; }
.auth-page .card {
    background: var(--rg-surface-strong) !important;
    border: 1px solid var(--rg-border) !important;
    border-radius: 18px !important;
    padding: 30px !important;
    box-shadow: var(--rg-shadow) !important;
    backdrop-filter: blur(20px);
}
.auth-page .card h2 { color: var(--rg-heading) !important; }
.auth-page .register-link,
.auth-page .login-link,
.auth-page .auth-footer,
.auth-page .password-hint,
.auth-page .forgot-password-link,
.auth-page .auth-info { color: var(--rg-muted) !important; }
.auth-page a { color: var(--rg-accent-3) !important; }
.auth-page .auth-footer { border-color: var(--rg-border) !important; }
.auth-theme-toggle {
    position: fixed !important;
    z-index: 20 !important;
    right: 20px !important;
    top: 20px !important;
}

/* =========================================================
   Upload – Inline-Styles auf RG-Design ziehen
   ========================================================= */
body .page {
    position: relative;
    z-index: 1;
}
.page > .topbar {
    border: 1px solid var(--rg-border) !important;
    border-radius: 16px !important;
    padding: 14px 16px !important;
    margin-bottom: 18px !important;
    background: var(--rg-topbar) !important;
    box-shadow: var(--rg-shadow-soft) !important;
}
.brand-icon img { border-radius: 10px; filter: drop-shadow(0 6px 14px rgba(0,190,231,.20)); }
.upload-zone {
    background: linear-gradient(145deg, var(--rg-surface-soft), var(--rg-surface)) !important;
    border: 1px dashed var(--rg-border-strong) !important;
    color: var(--rg-text) !important;
}
.upload-zone:hover { border-color: var(--rg-accent) !important; background: var(--rg-accent-soft) !important; }
.upload-title { color: var(--rg-heading) !important; }
.upload-description { color: var(--rg-muted) !important; }
.results, .result-content, .folder-info { border-color: var(--rg-border) !important; }

/* =========================================================
   Öffentliche Freigabe
   ========================================================= */
body > .card:only-child,
body > .share-box {
    background: var(--rg-surface-strong) !important;
    border: 1px solid var(--rg-border) !important;
    box-shadow: var(--rg-shadow) !important;
}

/* ---------- Plans / Support ---------- */
.plan-price { color: var(--rg-accent-3) !important; }
.plan-card-current { border-color: var(--rg-accent) !important; box-shadow: 0 0 0 1px rgba(0,200,237,.18), var(--rg-shadow-soft) !important; }
.payment-instructions, .payment-total { background: var(--rg-surface-soft) !important; border-color: var(--rg-border) !important; color: var(--rg-text) !important; }
.payment-status-pending, .payment-account-alert { background: rgba(217,119,6,.13) !important; color: var(--rg-warning) !important; }
.payment-status-approved { background: rgba(5,150,105,.13) !important; color: var(--rg-success) !important; }
.payment-status-rejected { background: rgba(220,38,38,.13) !important; color: var(--rg-danger) !important; }
.payment-status-cancelled { background: var(--rg-surface-soft) !important; color: var(--rg-muted) !important; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
    .sidebar {
        background: var(--rg-sidebar) !important;
        border-bottom: 1px solid var(--rg-border) !important;
        box-shadow: 0 10px 30px rgba(10,131,216,.05);
    }
    .content { padding: 20px 16px !important; }
    .topbar { padding-left: 16px !important; padding-right: 16px !important; }
}

@media (max-width: 520px) {
    body.auth-page { padding: 18px 14px !important; }
    .auth-page .card { padding: 24px 20px !important; }
    .auth-theme-toggle { top: 12px !important; right: 12px !important; }
    .auth-page .brand h1 { font-size: 25px !important; }
}

/* ---------- Weitere Inhaltsblöcke ---------- */
.breadcrumbs,
.folder-tree,
.file-bulk-toolbar,
.share-section,
.share-file,
.admin-form,
.plan-form,
.payment-report-form,
.account-form,
.result-content,
.results,
.folder-info,
.share-link-area,
.owner-section {
    border-color: var(--rg-border) !important;
    color: var(--rg-text) !important;
}

.folder-tree,
.file-bulk-toolbar,
.share-section,
.admin-form,
.plan-form,
.payment-report-form {
    background: var(--rg-surface-soft) !important;
}

.folder-tree-row:hover,
.share-file:hover {
    background: var(--rg-accent-soft) !important;
}

.folder-tree-name,
.share-file-name,
.account-email,
.plan-title-row,
.share-title,
.storage-header {
    color: var(--rg-heading) !important;
}

.breadcrumbs,
.breadcrumbs span,
.folder-info-text,
.share-file-info,
.admin-detail-meta,
.admin-storage-info,
.payment-validity {
    color: var(--rg-muted) !important;
}

.file-actions a,
.folder-actions a,
.folder-actions button,
.file-actions button {
    border-color: var(--rg-border) !important;
    background: var(--rg-surface-soft) !important;
    color: var(--rg-text) !important;
    border-radius: 8px !important;
}
.file-actions a:hover,
.folder-actions a:hover,
.folder-actions button:hover,
.file-actions button:hover {
    border-color: var(--rg-border-strong) !important;
    background: var(--rg-accent-soft) !important;
    color: var(--rg-heading) !important;
}

.file-preview,
.file-preview-image {
    background: var(--rg-surface-soft) !important;
    border-color: var(--rg-border) !important;
}

hr { border-color: var(--rg-border) !important; }

/* Share-Seite folgt dem gleichen Auth-/Login-Stil */
body.public-theme-page {
    min-height: 100vh;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 28px 18px !important;
}
body.public-theme-page > .card {
    position: relative;
    z-index: 2;
    background: var(--rg-surface-strong) !important;
    border: 1px solid var(--rg-border) !important;
    box-shadow: var(--rg-shadow) !important;
    backdrop-filter: blur(20px);
}

/* =========================================================
   V14 – echter LIGHT MODE
   ---------------------------------------------------------
   Light und Dark sind bewusst deutlich getrennt. Light nutzt
   helle, nahezu deckende Flächen statt dunkler Glas-Optik.
   ========================================================= */

body.light,
body.theme-light,
html.theme-light body {
    color-scheme: light;
    --rg-bg: #f7fafc;
    --rg-bg-2: #eef5f9;
    --rg-surface: #ffffff;
    --rg-surface-strong: #ffffff;
    --rg-surface-soft: #f6fafc;
    --rg-border: #dbe6ee;
    --rg-border-strong: #b9d8e8;
    --rg-text: #263445;
    --rg-heading: #0f172a;
    --rg-muted: #64748b;
    --rg-accent: #00bfe8;
    --rg-accent-2: #0a83d8;
    --rg-accent-3: #0875bd;
    --rg-accent-soft: #eaf9fd;
    --rg-success: #05845f;
    --rg-warning: #b96905;
    --rg-danger: #c92a2a;
    --rg-shadow: 0 18px 48px rgba(15, 23, 42, .09);
    --rg-shadow-soft: 0 6px 22px rgba(15, 23, 42, .065);
    --rg-input: #ffffff;
    --rg-grid: rgba(14, 165, 233, .025);
    --rg-sidebar: #ffffff;
    --rg-topbar: rgba(255, 255, 255, .96);

    background:
        radial-gradient(circle at 50% 0%, rgba(0, 191, 232, .075), transparent 30%),
        radial-gradient(circle at 100% 100%, rgba(10, 131, 216, .045), transparent 26%),
        linear-gradient(145deg, #f9fcfe 0%, #f3f8fb 52%, #edf4f8 100%) !important;
    color: var(--rg-text) !important;
}

body.light::before,
body.theme-light::before,
html.theme-light body::before {
    opacity: .72;
}

body.light::after,
body.theme-light::after,
html.theme-light body::after {
    opacity: .012 !important;
    filter: saturate(.85) contrast(.9);
}

/* Light: App-Shell wirklich weiß/hell */
body.light .app,
body.light .main,
body.theme-light .app,
body.theme-light .main,
html.theme-light body .app,
html.theme-light body .main {
    background: transparent !important;
    color: var(--rg-text) !important;
}

body.light .sidebar,
body.theme-light .sidebar,
html.theme-light body .sidebar {
    background: #ffffff !important;
    border-color: #dce7ee !important;
    box-shadow: 8px 0 28px rgba(15, 23, 42, .035) !important;
}

body.light .topbar,
body.theme-light .topbar,
html.theme-light body .topbar {
    background: rgba(255, 255, 255, .96) !important;
    border-color: #dce7ee !important;
    box-shadow: 0 5px 20px rgba(15, 23, 42, .035) !important;
}

body.light .card,
body.light .folder-card,
body.light .share-card,
body.light .admin-stat-card,
body.light .admin-detail-card,
body.light .admin-storage-card,
body.light .plan-card,
body.light .account-card,
body.light .payment-current-card,
body.light .payment-pending-card,
body.light .payment-account-review-card,
body.light .payment-admin-warning,
body.light .payment-rule-note,
body.light .storage-widget,
body.light .share-box,
body.light .owner-section,
body.theme-light .card,
body.theme-light .folder-card,
body.theme-light .share-card,
body.theme-light .admin-stat-card,
body.theme-light .admin-detail-card,
body.theme-light .admin-storage-card,
body.theme-light .plan-card,
body.theme-light .account-card,
body.theme-light .payment-current-card,
body.theme-light .payment-pending-card,
body.theme-light .payment-account-review-card,
body.theme-light .storage-widget,
html.theme-light body .card,
html.theme-light body .folder-card,
html.theme-light body .share-card,
html.theme-light body .admin-stat-card,
html.theme-light body .admin-detail-card,
html.theme-light body .admin-storage-card,
html.theme-light body .plan-card,
html.theme-light body .account-card,
html.theme-light body .storage-widget {
    background: #ffffff !important;
    color: #263445 !important;
    border-color: #dce7ee !important;
    box-shadow: 0 7px 24px rgba(15, 23, 42, .06) !important;
}

body.light input[type="text"],
body.light input[type="email"],
body.light input[type="password"],
body.light input[type="number"],
body.light input[type="search"],
body.light input[type="file"],
body.light select,
body.light textarea,
body.theme-light input,
body.theme-light select,
body.theme-light textarea,
html.theme-light body input,
html.theme-light body select,
html.theme-light body textarea {
    background: #ffffff !important;
    color: #1f2937 !important;
    border-color: #d6e0e7 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .025) !important;
}

body.light input:focus,
body.light select:focus,
body.light textarea:focus,
body.theme-light input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus,
html.theme-light body input:focus,
html.theme-light body select:focus,
html.theme-light body textarea:focus {
    border-color: #00aeda !important;
    box-shadow: 0 0 0 3px rgba(0, 174, 218, .12) !important;
}

body.light .folder-tree,
body.light .file-bulk-toolbar,
body.light .share-section,
body.light .admin-form,
body.light .plan-form,
body.light .payment-report-form,
body.light .payment-instructions,
body.light .payment-total,
body.theme-light .folder-tree,
body.theme-light .file-bulk-toolbar,
body.theme-light .share-section,
body.theme-light .admin-form,
body.theme-light .plan-form,
body.theme-light .payment-report-form,
html.theme-light body .folder-tree,
html.theme-light body .file-bulk-toolbar,
html.theme-light body .share-section,
html.theme-light body .admin-form,
html.theme-light body .plan-form {
    background: #f8fbfd !important;
    color: #263445 !important;
    border-color: #dce7ee !important;
}

body.light .file-table th,
body.light .admin-user-table-wrapper th,
body.light .payment-table th,
body.theme-light .file-table th,
body.theme-light .admin-user-table-wrapper th,
body.theme-light .payment-table th,
html.theme-light body .file-table th,
html.theme-light body .admin-user-table-wrapper th,
html.theme-light body .payment-table th {
    background: #f5f9fc !important;
    color: #607286 !important;
    border-color: #dce7ee !important;
}

body.light .file-table td,
body.light .admin-user-table-wrapper td,
body.light .payment-table td,
body.theme-light .file-table td,
body.theme-light .admin-user-table-wrapper td,
body.theme-light .payment-table td,
html.theme-light body .file-table td,
html.theme-light body .admin-user-table-wrapper td,
html.theme-light body .payment-table td {
    background: #ffffff !important;
    color: #263445 !important;
    border-color: #e2ebf0 !important;
}

body.light .file-table tr:hover td,
body.light .admin-user-table-wrapper tr:hover td,
body.light .payment-table tr:hover td,
body.theme-light .file-table tr:hover td,
body.theme-light .admin-user-table-wrapper tr:hover td,
body.theme-light .payment-table tr:hover td,
html.theme-light body .file-table tr:hover td,
html.theme-light body .admin-user-table-wrapper tr:hover td,
html.theme-light body .payment-table tr:hover td {
    background: #f0fbfe !important;
}

body.light .nav a,
body.theme-light .nav a,
html.theme-light body .nav a {
    color: #3a4a5d !important;
}

body.light .nav a:hover,
body.theme-light .nav a:hover,
html.theme-light body .nav a:hover {
    background: #eff9fc !important;
    color: #0f172a !important;
}

body.light .nav a.active,
body.theme-light .nav a.active,
html.theme-light body .nav a.active {
    background: linear-gradient(135deg, #e8fafe, #edf6ff) !important;
    color: #0875bd !important;
    border-color: #b9ddea !important;
}

body.light .theme-toggle,
body.light .auth-theme-toggle,
body.theme-light .theme-toggle,
body.theme-light .auth-theme-toggle,
html.theme-light body .theme-toggle,
html.theme-light body .auth-theme-toggle {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #d6e0e7 !important;
    box-shadow: 0 5px 16px rgba(15, 23, 42, .07) !important;
}

/* Auth Light: klare helle Login-Variante */
body.auth-page.light,
body.auth-page.theme-light,
html.theme-light body.auth-page {
    background:
        radial-gradient(circle at 50% 12%, rgba(0, 191, 232, .10), transparent 30%),
        radial-gradient(circle at 0% 100%, rgba(10, 131, 216, .05), transparent 28%),
        linear-gradient(145deg, #fbfdff 0%, #f5fafd 48%, #eef5f9 100%) !important;
    color: #263445 !important;
}

body.auth-page.light::before,
body.auth-page.theme-light::before,
html.theme-light body.auth-page::before {
    background-image:
        linear-gradient(rgba(14, 165, 233, .022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, .022) 1px, transparent 1px) !important;
}

body.auth-page.light .card,
body.auth-page.theme-light .card,
html.theme-light body.auth-page .card {
    background: rgba(255, 255, 255, .985) !important;
    border-color: #dce7ee !important;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .09) !important;
}

body.auth-page.light .brand h1,
body.auth-page.light .card h2,
body.auth-page.light .form-group label,
body.auth-page.theme-light .brand h1,
body.auth-page.theme-light .card h2,
body.auth-page.theme-light .form-group label,
html.theme-light body.auth-page .brand h1,
html.theme-light body.auth-page .card h2,
html.theme-light body.auth-page .form-group label {
    color: #0f172a !important;
}

body.auth-page.light .brand p,
body.auth-page.light .register-link,
body.auth-page.light .login-link,
body.auth-page.light .auth-footer,
body.auth-page.light .password-hint,
body.auth-page.light .forgot-password-link,
body.auth-page.light .auth-info,
body.auth-page.theme-light .brand p,
body.auth-page.theme-light .register-link,
body.auth-page.theme-light .login-link,
body.auth-page.theme-light .auth-footer,
body.auth-page.theme-light .password-hint,
body.auth-page.theme-light .forgot-password-link,
body.auth-page.theme-light .auth-info,
html.theme-light body.auth-page .brand p,
html.theme-light body.auth-page .register-link,
html.theme-light body.auth-page .login-link,
html.theme-light body.auth-page .auth-footer,
html.theme-light body.auth-page .password-hint,
html.theme-light body.auth-page .forgot-password-link,
html.theme-light body.auth-page .auth-info {
    color: #64748b !important;
}

body.auth-page.light .auth-logo,
body.auth-page.theme-light .auth-logo,
html.theme-light body.auth-page .auth-logo {
    filter: drop-shadow(0 10px 24px rgba(0, 151, 197, .16)) !important;
}

/* Upload-Seite enthält eigene Inline-CSS-Regeln: im Light Mode explizit überschreiben. */
body.light .upload-zone,
body.theme-light .upload-zone,
html.theme-light body .upload-zone {
    background: #f8fcfe !important;
    color: #263445 !important;
    border-color: #b9d8e8 !important;
}

body.light .results,
body.light .result-content,
body.light .folder-info,
body.theme-light .results,
body.theme-light .result-content,
body.theme-light .folder-info,
html.theme-light body .results,
html.theme-light body .result-content,
html.theme-light body .folder-info {
    background: #ffffff !important;
    color: #263445 !important;
    border-color: #dce7ee !important;
}

/* =========================================================
   V15 – Login-Hintergrund jetzt in der GESAMTEN Cloud
   ---------------------------------------------------------
   Dark: exakt dieselbe atmosphärische Basis wie die Loginseite.
   Light: dieselbe Komposition, aber klar hell/weiß-blau.

   Wichtig: style.css enthält ältere Dark-Mode-Regeln, die .app
   und .main deckend einfärben. Diese werden hier bewusst mit
   transparent !important überschrieben, damit der Seiten-
   hintergrund wirklich sichtbar bleibt.
   ========================================================= */

/* App-Container dürfen den Seitenhintergrund niemals verdecken. */
body.dark .app,
body.dark .main,
body.dark .content,
body.theme-dark .app,
body.theme-dark .main,
body.theme-dark .content,
html.theme-dark body .app,
html.theme-dark body .main,
html.theme-dark body .content,
body.light .app,
body.light .main,
body.light .content,
body.theme-light .app,
body.theme-light .main,
body.theme-light .content,
html.theme-light body .app,
html.theme-light body .main,
html.theme-light body .content {
    background: transparent !important;
}

/* DARK – derselbe Hintergrund wie auf der Loginseite. */
body.dark,
body.theme-dark,
html.theme-dark body {
    background:
        radial-gradient(circle at 50% 10%, rgba(0, 190, 255, .16), transparent 34%),
        radial-gradient(circle at 100% 80%, rgba(10, 131, 216, .10), transparent 28%),
        linear-gradient(145deg, #030912 0%, #07111f 100%) !important;
    background-attachment: fixed !important;
}

body.dark::before,
body.theme-dark::before,
html.theme-dark body::before {
    opacity: 1 !important;
    background-image:
        linear-gradient(rgba(14, 165, 233, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, .04) 1px, transparent 1px) !important;
    background-size: 34px 34px !important;
}

/* LIGHT – gleiche Hintergrundidee wie Login, nur wirklich hell. */
body.light,
body.theme-light,
html.theme-light body {
    background:
        radial-gradient(circle at 50% 12%, rgba(0, 191, 232, .10), transparent 30%),
        radial-gradient(circle at 0% 100%, rgba(10, 131, 216, .05), transparent 28%),
        linear-gradient(145deg, #fbfdff 0%, #f5fafd 48%, #eef5f9 100%) !important;
    background-attachment: fixed !important;
}

body.light::before,
body.theme-light::before,
html.theme-light body::before {
    opacity: 1 !important;
    background-image:
        linear-gradient(rgba(14, 165, 233, .022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, .022) 1px, transparent 1px) !important;
    background-size: 34px 34px !important;
}

/* Das dezente RoyalGamers-Wasserzeichen aus dem Login auch in der App. */
body:not(.auth-page):not(.public-theme-page)::after {
    width: min(740px, 74vw) !important;
    height: min(740px, 74vw) !important;
    right: 50% !important;
    bottom: 50% !important;
    transform: translate(50%, 50%) !important;
    background: url('assets/royalgamers-cloud-logo.png') center / contain no-repeat !important;
    filter: saturate(1.05) !important;
}

body.dark:not(.auth-page):not(.public-theme-page)::after,
body.theme-dark:not(.auth-page):not(.public-theme-page)::after,
html.theme-dark body:not(.auth-page):not(.public-theme-page)::after {
    opacity: .018 !important;
}

body.light:not(.auth-page):not(.public-theme-page)::after,
body.theme-light:not(.auth-page):not(.public-theme-page)::after,
html.theme-light body:not(.auth-page):not(.public-theme-page)::after {
    opacity: .010 !important;
    filter: saturate(.78) contrast(.92) !important;
}

/* Dark Mode: Glasflächen lassen den Login-Hintergrund sichtbar. */
body.dark .sidebar,
body.theme-dark .sidebar,
html.theme-dark body .sidebar {
    background: rgba(5, 14, 27, .88) !important;
    backdrop-filter: blur(20px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
}

body.dark .topbar,
body.theme-dark .topbar,
html.theme-dark body .topbar {
    background: rgba(5, 14, 27, .72) !important;
    backdrop-filter: blur(18px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.08) !important;
}

body.dark .card,
body.dark .folder-card,
body.dark .share-card,
body.dark .admin-stat-card,
body.dark .admin-detail-card,
body.dark .admin-storage-card,
body.dark .plan-card,
body.dark .account-card,
body.dark .payment-current-card,
body.dark .payment-pending-card,
body.dark .payment-account-review-card,
body.dark .storage-widget,
body.theme-dark .card,
body.theme-dark .folder-card,
body.theme-dark .share-card,
body.theme-dark .admin-stat-card,
body.theme-dark .admin-detail-card,
body.theme-dark .admin-storage-card,
body.theme-dark .plan-card,
body.theme-dark .account-card,
body.theme-dark .storage-widget {
    background: rgba(8, 18, 32, .84) !important;
    backdrop-filter: blur(16px) saturate(1.06) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.06) !important;
}

/* Light Mode bleibt klar hell; nur der Hintergrund hat die Login-Tiefe. */
body.light .sidebar,
body.theme-light .sidebar,
html.theme-light body .sidebar {
    background: rgba(255, 255, 255, .94) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}

body.light .topbar,
body.theme-light .topbar,
html.theme-light body .topbar {
    background: rgba(255, 255, 255, .88) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
}


/* =========================================================
   V16 – Light-Pattern + ruhigere Topbar-Aktionen
   ---------------------------------------------------------
   Light erhält dasselbe sichtbare Rastergefühl wie Dark,
   nur in einer hellen Cyan/Blau-Abstufung.
   Dashboard-Link und Speicherstatus werden bewusst nicht
   mehr als gerahmte Karten in der Topbar dargestellt.
   ========================================================= */

/* LIGHT – das Raster soll wie im Dark Mode klar erkennbar sein. */
body.light::before,
body.theme-light::before,
html.theme-light body::before {
    opacity: 1 !important;
    background-image:
        linear-gradient(rgba(14, 165, 233, .070) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, .070) 1px, transparent 1px) !important;
    background-size: 34px 34px !important;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.94) 64%, transparent 100%) !important;
    mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.94) 64%, transparent 100%) !important;
}

/* Das Wasserzeichen darf im hellen Modus etwas sichtbarer sein,
   ohne die Lesbarkeit der Inhalte zu beeinflussen. */
body.light:not(.auth-page):not(.public-theme-page)::after,
body.theme-light:not(.auth-page):not(.public-theme-page)::after,
html.theme-light body:not(.auth-page):not(.public-theme-page)::after {
    opacity: .017 !important;
}

/* Dashboard/Zurück: kein harter Rahmen mehr. */
.back-link {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 38px !important;
    padding: 7px 10px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--rg-muted) !important;
    font-weight: 650 !important;
    text-decoration: none !important;
    transition: background .16s ease, color .16s ease, transform .16s ease !important;
}

.back-link:hover {
    border: 0 !important;
    background: var(--rg-accent-soft) !important;
    color: var(--rg-accent-3) !important;
    box-shadow: none !important;
    transform: translateX(-2px) !important;
    text-decoration: none !important;
}

/* Speicherstatus oben rechts: schlank in die Topbar integriert. */
.topbar .storage-widget {
    width: 220px !important;
    padding: 2px 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.topbar .storage-header {
    margin-bottom: 6px !important;
    gap: 12px !important;
    line-height: 1.2 !important;
    color: var(--rg-muted) !important;
}

.topbar .storage-header span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .storage-header strong {
    flex: 0 0 auto;
    color: var(--rg-heading) !important;
    font-weight: 700 !important;
}

.topbar .storage-bar {
    height: 4px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--rg-muted) 18%, transparent) !important;
    box-shadow: none !important;
}

.topbar .storage-bar-fill {
    border-radius: inherit !important;
    box-shadow: 0 0 12px rgba(0, 200, 237, .18) !important;
}

.topbar .storage-percent {
    margin-top: 5px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    color: var(--rg-muted) !important;
    text-align: right !important;
}

/* Eine feine Trennung reicht – kein Kasten um die Speicheranzeige. */
.topbar-right > .storage-widget:first-child {
    position: relative;
    padding-right: 2px !important;
}

@media (max-width: 760px) {
    .topbar .storage-widget {
        width: min(190px, 44vw) !important;
    }

    .topbar .storage-header span {
        display: none;
    }

    .topbar .storage-percent {
        display: none;
    }
}

/* v20 – geschützter Datenbank-Restore im Adminbereich */
.restore-danger-zone {
    border-color: color-mix(in srgb, var(--rg-danger) 42%, var(--rg-border)) !important;
    box-shadow: 0 18px 54px rgba(120, 18, 28, .12) !important;
}
.restore-danger-zone h2 {
    color: color-mix(in srgb, var(--rg-danger) 82%, var(--rg-heading)) !important;
}
.restore-form-grid {
    display: grid;
    gap: .9rem;
    max-width: 760px;
}
.restore-form-grid label:not(.restore-checkbox) {
    display: grid;
    gap: .42rem;
    font-weight: 650;
}
.restore-form-grid input[type="password"],
.restore-form-grid input[type="text"],
.restore-form-grid select,
.restore-hash-box textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--rg-border);
    border-radius: 12px;
    padding: .78rem .9rem;
    background: var(--rg-input);
    color: var(--rg-text);
    outline: none;
}
.restore-form-grid input:focus,
.restore-form-grid select:focus,
.restore-hash-box textarea:focus {
    border-color: var(--rg-cyan);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--rg-cyan) 16%, transparent);
}
.restore-checkbox {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1rem;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--rg-danger) 32%, var(--rg-border));
    background: color-mix(in srgb, var(--rg-danger) 7%, transparent);
    line-height: 1.45;
}
.restore-checkbox input { margin-top: .18rem; }
.restore-button {
    justify-self: start;
    padding: .85rem 1.05rem;
}
.restore-note {
    margin-top: .9rem;
    color: var(--rg-muted);
    font-size: .92rem;
}
.restore-master-setup {
    margin-top: 1rem;
    border: 1px solid var(--rg-border);
    border-radius: 14px;
    padding: 1rem;
    background: color-mix(in srgb, var(--rg-card) 90%, transparent);
}
.restore-master-setup summary { cursor: pointer; }
.restore-hash-box {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--rg-cyan) 35%, var(--rg-border));
    border-radius: 12px;
    background: color-mix(in srgb, var(--rg-cyan) 6%, transparent);
}
.restore-hash-box textarea {
    min-height: 90px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
.restore-backup-table code { word-break: break-all; }
@media (max-width: 760px) {
    .restore-button { width: 100%; }
}


/* v21: global member support visibility */
body.support-panel-hidden a[href="plans.php"] {
    display: none !important;
}


/* v22: GPU-/Scroll-Performance */
.card,
.folder-card,
.share-card,
.admin-stat-card,
.admin-detail-card,
.admin-storage-card,
.plan-card,
.account-card,
.payment-current-card,
.payment-pending-card,
.payment-account-review-card,
.storage-widget,
.share-box,
.owner-section {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

@media (max-width: 820px) {
    body {
        background-attachment: scroll !important;
    }
}
