:root {
    --bg: #0a0a0c;
    --panel: #131317;
    --panel-2: #191920;
    --line: rgba(212, 175, 55, 0.2);
    --text: #f1f1f1;
    --muted: #b7b7b7;
    --gold: #d4af37;
    --gold-hover: #f1c40f;
    --danger: #ff6b6b;
    --success: #4caf7d;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    background: #1a1a22;
    border: 1px solid var(--success);
    color: var(--success);
    padding: 0.85rem 1.3rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    max-width: 320px;
}

.toast.toast-error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Inter, system-ui, sans-serif;
}

.dashboard-body {
    background: radial-gradient(circle at top, #1a1202, var(--bg) 38%);
    color: var(--text);
    min-height: 100vh;
}

.dash-header {
    border-bottom: 1px solid var(--line);
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-in 0.3s;
    pointer-events: none;
}

main.dash-layout {
    opacity: 0;
    transition: opacity 0.3s ease-in 0.3s;
    pointer-events: none;
}

/* Show header and main content when dashboard is ready */
.dashboard-ready .dash-header,
.dashboard-ready .dash-layout {
    opacity: 1;
    pointer-events: auto;
}

.eyebrow {
    color: var(--gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
}

h1 {
    font-family: Cinzel, serif;
    font-size: 1.7rem;
}

h2 {
    font-family: Cinzel, serif;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.muted {
    color: var(--muted);
    margin-bottom: 0.8rem;
}

.pill {
    border: 1px solid var(--line);
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    color: var(--gold);
    margin-right: 0.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
}

.lang-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-right: 0.6rem;
}

.lang-picker label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.lang-picker select {
    width: auto;
    min-width: 110px;
    background: #0f0f12;
    border: 1px solid #2d2d33;
    color: #fff;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
}

.dash-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.2rem;
    padding: 1.2rem;
}

.dash-sidebar, .panel {
    background: linear-gradient(145deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
}

.dash-sidebar small {
    color: var(--muted);
    display: block;
    margin-top: 0.9rem;
    line-height: 1.4;
}

.dash-content {
    display: grid;
    gap: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.form-stack {
    display: grid;
    gap: 0.75rem;
}

label {
    display: grid;
    gap: 0.38rem;
    font-weight: 600;
    color: #f5e7b2;
}

input, select, textarea {
    width: 100%;
    background: #0f0f12;
    border: 1px solid #2d2d33;
    border-radius: 8px;
    color: #fff;
    padding: 0.6rem;
}

textarea {
    resize: vertical;
}

.checkbox-line {
    align-items: center;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
}

.checkbox-line input {
    width: auto;
}

.span-2 {
    grid-column: 1 / -1;
}

/* Rarity Selector Styles */
.rarity-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.rarity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 0.6rem;
    border: 2px solid #3a3a42;
    border-radius: 8px;
    background: #0f0f12;
    color: #d0d0d0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.rarity-btn:hover {
    border-color: #5a5a62;
    background: #151518;
}

.rarity-btn.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    font-weight: 700;
}

.rarity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.common-rarity .rarity-dot {
    background: #808080;
}

.rare-rarity .rarity-dot {
    background: #4169e1;
}

.epic-rarity .rarity-dot {
    background: #9932cc;
}

.legendary-rarity .rarity-dot {
    background: #ff0000;
}

.rarity-btn.active.common-rarity .rarity-dot {
    background: #000;
}

.rarity-btn.active.rare-rarity .rarity-dot {
    background: #000;
}

.rarity-btn.active.epic-rarity .rarity-dot {
    background: #000;
}

.rarity-btn.active.legendary-rarity .rarity-dot {
    background: #000;
}

/* Rarity badge in pack table */
.rarity-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.common-badge   { background: rgba(128,128,128,0.2); border: 1px solid #808080; color: #ccc; }
.rare-badge     { background: rgba(65,105,225,0.2);  border: 1px solid #4169e1; color: #7ca3ff; }
.epic-badge     { background: rgba(153,50,204,0.2);  border: 1px solid #9932cc; color: #c87fff; }
.legendary-badge{ background: rgba(255,0,0,0.2);     border: 1px solid #ff0000; color: #ff7b7b; }
.unique-badge   { background: rgba(212,175,55,0.2);  border: 1px solid var(--gold); color: var(--gold); }

/* Pack thumbnail in table */
.pack-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #3a3a42;
    display: block;
}

.primary-btn, .ghost-btn {
    border: 1px solid var(--gold);
    border-radius: 9px;
    padding: 0.62rem 0.9rem;
    cursor: pointer;
    font-weight: 700;
}

.primary-btn {
    background: var(--gold);
    color: #101010;
}

.primary-btn:hover {
    background: var(--gold-hover);
}

.ghost-btn {
    background: transparent;
    color: var(--gold);
}

.docs-anchor {
    margin-top: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    text-decoration: none;
}

.view-toggle-btn.active {
    background: rgba(212, 175, 55, 0.18);
    color: #f8d66e;
    border-color: var(--gold);
}

.view-toggle-btn:not(.active) {
    opacity: 0.9;
}

.metrics-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.55rem;
}

.metrics-generated-at {
    margin-bottom: 0.9rem;
}

.metrics-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.metrics-card {
    background: #101016;
    border: 1px solid #2f2f37;
    border-radius: 10px;
    padding: 0.7rem;
}

.metrics-card-label {
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

.metrics-card-value {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.05rem;
}

.metrics-subtitle {
    margin-top: 0.8rem;
    margin-bottom: 0.55rem;
    font-size: 1rem;
}

.metrics-alerts-list,
.metrics-errors-list {
    display: grid;
    gap: 0.5rem;
}

.metrics-alert {
    border: 1px solid #383840;
    border-radius: 9px;
    background: #111116;
    padding: 0.55rem 0.65rem;
    display: grid;
    gap: 0.25rem;
}

.metrics-alert-high {
    border-color: rgba(255, 107, 107, 0.6);
}

.metrics-alert-medium {
    border-color: rgba(212, 175, 55, 0.5);
}

.metrics-alert-info {
    border-color: rgba(102, 163, 255, 0.55);
}

.metrics-trace-item {
    border: 1px solid #2f2f37;
    border-radius: 9px;
    background: #0f0f14;
    padding: 0.55rem 0.65rem;
    display: grid;
    gap: 0.22rem;
}

.metrics-trace-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.metrics-trace-source {
    color: var(--gold);
    font-weight: 700;
}

.metrics-trace-meta {
    color: #d8d8dd;
    font-size: 0.86rem;
}

.metrics-trace-message {
    color: #ffb0b0;
    font-size: 0.88rem;
    word-break: break-word;
}

.metrics-empty {
    color: var(--muted);
    font-size: 0.92rem;
    padding: 0.45rem 0;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 0.6rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border-bottom: 1px solid #2a2a31;
    padding: 0.55rem;
    text-align: left;
    font-size: 0.92rem;
}

th {
    color: var(--gold);
}

.action-row {
    display: flex;
    gap: 0.4rem;
}

.mini-btn {
    border: 1px solid var(--line);
    background: #101014;
    color: #f2f2f2;
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
}

.mini-btn:hover {
    border-color: var(--gold);
}

.mini-btn.danger {
    border-color: rgba(255, 107, 107, 0.5);
    color: var(--danger);
}

.status-text {
    min-height: 1.3rem;
    color: #8cd48a;
    font-weight: 600;
}

.status-error {
    color: #ff8b8b;
}

.status-success {
    color: #8cd48a;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.login-card {
    width: min(460px, 96vw);
    background: linear-gradient(145deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.2rem;
}

.login-actions {
    margin-top: 0.8rem;
}

.login-actions a {
    color: var(--gold);
    text-decoration: none;
}

@media (max-width: 900px) {
    .dash-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .lang-picker {
        margin-right: 0;
    }

    .lang-picker label {
        display: none;
    }

    .pill {
        display: none;
    }

    .metrics-header-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Loading Spinner Styles */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 12, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease-out;
    pointer-events: auto;
}

.loading-spinner.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner.visible {
    opacity: 1;
    pointer-events: auto;
}

.spinner-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.spinner-animation {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-text {
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── Card Builder ── */
.card-drafts-container,
.saved-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.25rem;
}

.card-draft-block {
    position: relative;
    width: 100%;
    max-width: 350px;
    border: 1px solid #ffffff30;
    border-radius: 10px;
    padding: 10px;
    background: #0f0f12;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.card-draft-block label {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}

.card-draft-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.card-draft-img-preview {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #2a2a31;
    display: none;
}

/* Saved cards */
.saved-card-block {
    position: relative;
    width: 100%;
    max-width: 250px;
    border: 1px solid #ffffff18;
    border-radius: 10px;
    padding: 10px;
    background: #0f0f12;
    overflow: hidden;
    cursor: default;
}

.saved-card-block:hover {
    border-color: #ffffff40;
}

.saved-card-block img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: block;
}

.saved-card-block .card-info-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-card-block .card-info-rarity {
    font-size: 0.8rem;
}

.saved-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 0.35rem;
}

.saved-card-block:hover .saved-card-actions {
    display: flex;
}

.saved-card-action-btn {
    background: rgba(10,10,14,0.85);
    border: 1px solid #3a3a42;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: border-color 0.15s;
}

.saved-card-action-btn:hover { border-color: var(--gold); }
.saved-card-action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ─── Automation Panel Styles ─── */
.automation-form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
}

.automation-form-section h3 {
    margin-bottom: 1rem;
    color: var(--gold);
    font-size: 1.1rem;
}

#automation-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

#automation-form .form-group {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
}

#automation-form .checkbox-group {
    flex: 1;
    min-width: 200px;
    justify-content: flex-end;
    margin-bottom: 0;
}

#automation-form .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

#automation-form .checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#automation-form button {
    padding: 0.6rem 1.2rem;
    height: fit-content;
}

#automation-form label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}

#automation-form input,
#automation-form select {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: 0.6rem;
    font-size: 0.95rem;
}

#automation-form input:focus,
#automation-form select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.15);
}

#automation-rules-body tr {
    border-bottom: 1px solid var(--line);
}

#automation-rules-body td {
    padding: 0.8rem;
    text-align: left;
}

#automation-rules-body .delete-automation-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #3a3a42;
    border-radius: 4px;
    background: rgba(10,10,14,0.85);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

#automation-rules-body .delete-automation-btn:hover {
    border-color: var(--danger);
}

/* XP override section inside the automation form */
.automation-xp-section {
    width: 100%;
    flex-basis: 100%;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--line);
}

.automation-xp-section .muted {
    font-size: 0.82rem;
    margin-bottom: 0.5rem;
}

.automation-xp-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.automation-xp-fields .form-group {
    flex: 1;
    min-width: 130px;
}

.automation-xp-fields input {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: 0.5rem;
    font-size: 0.88rem;
    width: 100%;
}

.automation-xp-fields input:focus {
    outline: none;
    border-color: var(--gold);
}

.automation-xp-fields label {
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
    color: var(--muted);
}

/* "global" badge shown in table cells when override is not set */
.xp-global-badge {
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic;
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

@media (max-width: 700px) {
    #automation-form {
        flex-direction: column;
        align-items: stretch;
    }

    #automation-form .form-group {
        min-width: unset;
    }

    #automation-form .checkbox-group {
        justify-content: flex-start;
    }

    #automation-form button {
        width: 100%;
    }

    .automation-xp-fields {
        flex-direction: column;
    }

    .automation-xp-fields .form-group {
        min-width: unset;
    }

    #automation-rules-body td {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
}

/* ─── Support Chatbox ─── */
.support-chatbox {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9998;
    width: min(420px, calc(100vw - 2rem));
}

.support-chat-toggle {
    width: 100%;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, #1b1b24, #111119);
    color: var(--gold);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.support-chat-panel {
    margin-top: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f0f16;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.support-chat-header {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.support-chat-toolbar {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.16);
}

.support-chat-toolbar .ghost-btn {
    width: 100%;
}

.support-chat-messages {
    max-height: 260px;
    overflow-y: auto;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.support-chat-empty {
    color: var(--muted);
    font-size: 0.9rem;
}

.support-msg-item {
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-right: 6px solid #8a8a8a;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    background: rgba(255, 255, 255, 0.02);
}

.support-msg-item.status-resolved {
    border-right-color: #2ecc71;
}

.support-msg-item.status-open {
    border-right-color: #8a8a8a;
}

.support-msg-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.support-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
}

.support-msg-owner-actions {
    margin-top: 0.45rem;
    display: flex;
    justify-content: flex-end;
}

.support-msg-owner-actions .mini-btn {
    padding: 0.32rem 0.55rem;
    font-size: 0.78rem;
}

.support-chat-form {
    border-top: 1px solid var(--line);
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.support-chat-form textarea {
    resize: vertical;
    min-height: 72px;
    max-height: 180px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #0a0a10;
    color: var(--text);
    padding: 0.65rem;
}

.support-chat-form textarea:focus {
    outline: none;
    border-color: var(--gold);
}

.support-chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
}

.support-chat-action-buttons {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.support-chat-actions .primary-btn {
    padding: 0.45rem 0.8rem;
    white-space: nowrap;
}

/* ==========================================
   Owner Inbox Panel (sidebar button + main panel)
   ========================================== */
.owner-inbox-sidebar-btn {
    position: relative;
}

.owner-inbox-count-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    background: #e74c3c;
    color: #fff;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 1.2em;
    height: 1.2em;
    line-height: 1.2em;
    padding: 0 0.3em;
    text-align: center;
}

.owner-inbox-panel {
    border-left: 4px solid #7c5cbf;
}

.owner-inbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.85rem;
    max-height: 520px;
    overflow-y: auto;
}

.owner-inbox-empty {
    color: var(--text-muted, #888);
    font-size: 0.93rem;
    padding: 0.5rem 0;
}

.owner-inbox-item {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-left: 5px solid #f39c12;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.owner-inbox-item-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted, #aaa);
}

.owner-inbox-badge {
    background: #f39c12;
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.14rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.owner-inbox-meta {
    flex: 1;
}

.owner-inbox-guild {
    margin-left: auto;
    font-family: monospace;
    font-size: 0.79rem;
    color: var(--text-muted, #999);
    word-break: break-all;
}

.owner-inbox-text {
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.owner-inbox-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

/* ─── Global Decks Grid & Custom Slider ─── */
.global-decks-grid {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.global-deck-server-wrapper {
    background: var(--panel-2);
    border-radius: 12px;
    padding: 1.1rem;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    min-width: 0; /* evita overflow en grid */
}

.global-deck-server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.global-deck-server-header h3 {
    margin: 0;
    color: var(--gold);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Swiper Container inside Server */
.global-deck-swiper {
    width: 100%;
    overflow: hidden; /* requerido por Swiper */
    padding-bottom: 2rem; /* espacio para los bullets de paginacion */
    box-sizing: border-box;
}

.swiper-pagination-bullet {
    background: var(--text-muted);
}
.swiper-pagination-bullet-active {
    background: var(--gold);
}

/* La card: Swiper controla el ancho, nosotros controlamos el layout interno */
.global-deck-slider-card {
    background: #0a0a10;
    border-radius: 8px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* clip imagen al border-radius */
    height: 100%;
    box-sizing: border-box;
}

.global-deck-slider-card img {
    width: 100%;
    aspect-ratio: 3 / 4; /* proporciones de carta */
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.global-deck-slider-card .card-info-name {
    font-size: 0.8rem;
    line-height: 1.3;
    padding: 0.45rem 0.4rem 0.2rem;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.global-deck-slider-card .card-info-rarity {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0 0.4rem 0.5rem;
    flex-shrink: 0;
}

.global-deck-server-footer {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}

/* ─── Server Deck Detail View ─── */
.server-deck-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.server-deck-detail-header h2 {
    margin: 0;
    flex: 1;
}

.server-deck-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.85rem;
    margin-top: 0.5rem;
    padding-bottom: 80px; /* espacio para la barra flotante */
}

.server-deck-detail-card {
    background: #0a0a10;
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
    position: relative;
    cursor: pointer;
}

.server-deck-detail-card:hover {
    border-color: var(--gold);
}

.server-deck-detail-card.sdd-selected {
    border-color: #5865F2;
    box-shadow: 0 0 0 2px #5865F2;
}

/* Checkbox flotante encima de la imagen */
.sdd-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 18px;
    height: 18px;
    accent-color: #5865F2;
    cursor: pointer;
    border-radius: 3px;
}

.server-deck-detail-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

.server-deck-detail-card .sdd-name {
    font-size: 0.75rem;
    color: #fff;
    text-align: center;
    padding: 0.35rem 0.3rem 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-deck-detail-card .sdd-rarity {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0 0.3rem 0.35rem;
}

/* Barra flotante de accion */
.clone-selected-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-2);
    border: 1px solid #5865F2;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 999;
    white-space: nowrap;
}

.clone-selected-bar span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Nombre de servidor clickeable en el directory */
.global-deck-server-title-link {
    color: var(--gold);
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
    font-size: 1rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.global-deck-server-title-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}
