/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
    --app-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --app-primary: #6366f1;
    --app-primary-hover: #4f46e5;
    --app-primary-light: rgba(99, 102, 241, 0.10);
    --app-accent: #8b5cf6;
    --app-bg: #f1f5f9;
    --app-surface: #ffffff;
    --app-text: #0f172a;
    --app-text-secondary: #64748b;
    --app-border: #e2e8f0;
    --app-shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --app-shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --app-shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
    --app-shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
    --app-radius-sm: 8px;
    --app-radius: 12px;
    --app-radius-lg: 16px;
    --app-radius-xl: 20px;
    --app-transition: 0.2s ease;
    --app-success: #10b981;
    --app-danger: #ef4444;
    --app-warning: #f59e0b;
}

/* ── Base ───────────────────────────────────────────────────────── */
html, body {
    font-family: var(--app-font);
    background: var(--app-bg);
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link {
    color: var(--app-primary);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    font-weight: 600;
    border-radius: var(--app-radius-sm);
    transition: all var(--app-transition);
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    color: #fff;
    background: var(--app-primary);
    border-color: var(--app-primary);
    box-shadow: 0 1px 2px rgba(99,102,241,0.3);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-outline-primary:hover {
    background: var(--app-primary);
    border-color: var(--app-primary);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}

.btn-outline-secondary:hover {
    background: var(--app-bg);
    border-color: var(--app-text-secondary);
    color: var(--app-text);
}

.btn-outline-danger {
    border-color: var(--app-border);
    color: var(--app-danger);
}

.btn-outline-danger:hover {
    background: var(--app-danger);
    border-color: var(--app-danger);
    color: #fff;
}

.btn-success {
    background: var(--app-success);
    border-color: var(--app-success);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem var(--app-primary-light);
}

/* ── Form Controls ──────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: var(--app-radius-sm);
    border-color: var(--app-border);
    transition: border-color var(--app-transition), box-shadow var(--app-transition);
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px var(--app-primary-light);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-secondary);
    margin-bottom: 0.4rem;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-xs);
    transition: box-shadow var(--app-transition), transform var(--app-transition);
}

.app-card:hover {
    box-shadow: var(--app-shadow);
}

.app-card-interactive:hover {
    box-shadow: var(--app-shadow);
    transform: translateY(-2px);
}

/* ── Tables ─────────────────────────────────────────────────────── */
.app-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.app-table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--app-border);
    background: var(--app-bg);
}

.app-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.app-table tbody tr:last-child td {
    border-bottom: none;
}

.app-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.owned-indicator,
.rarity-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.owned-full {
    background: var(--app-success);
}

.owned-partial {
    background: var(--app-warning);
}

.owned-none {
    background: var(--app-danger);
}

.rarity-common {
    background: #111827;
}

.rarity-uncommon {
    background: #c0c0c0;
}

.rarity-rare {
    background: #d4af37;
}

.rarity-mythic {
    background: #d35400;
}

/* ── Modals ─────────────────────────────────────────────────────── */
.app-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: modalFadeIn 0.2s ease;
}

.app-modal {
    background: var(--app-surface);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    animation: modalSlideIn 0.25s ease;
}

.app-modal-lg {
    max-width: 680px;
}

.app-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-modal-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.app-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

.app-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--app-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.app-modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-text-secondary);
    cursor: pointer;
    transition: all var(--app-transition);
}

.app-modal-close:hover {
    background: var(--app-bg);
    color: var(--app-text);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── AI Loading Overlay ─────────────────────────────────────────── */
.ai-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: modalFadeIn 0.3s ease;
}

.ai-loading-content {
    text-align: center;
    color: #ffffff;
}

.ai-loading-content h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.ai-loading-content p {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    margin: 0;
}

.ai-spinner {
    width: 52px;
    height: 52px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--app-primary);
    border-radius: 50%;
    animation: aiSpin 0.7s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

/* ── Page Sections ──────────────────────────────────────────────── */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--app-text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-text-secondary);
    margin-bottom: 0.75rem;
}

/* ── Badge / Chip ───────────────────────────────────────────────── */
.app-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.app-badge-primary {
    background: var(--app-primary-light);
    color: var(--app-primary);
}

.app-badge-muted {
    background: var(--app-bg);
    color: var(--app-text-secondary);
}

/* ── Deck Type Tag ──────────────────────────────────────────────── */
.deck-type-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    background: transparent;
    color: var(--app-accent);
    border: 1px solid rgba(139, 92, 246, 0.6);
    box-shadow: none;
    white-space: nowrap;
}

/* ── Quantity Control ───────────────────────────────────────────── */
.qty-control {
    display: inline-flex;
    align-items: center;
}

.qty-control .qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 28px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background var(--app-transition), color var(--app-transition);
    padding: 0;
    line-height: 1;
}

.qty-control .qty-btn:hover {
    background: var(--app-primary-light);
    color: var(--app-primary);
}

.qty-control .qty-btn-minus {
    border-radius: var(--app-radius-sm) 0 0 var(--app-radius-sm);
    border-right: none;
    color: var(--app-danger);
}

.qty-control .qty-btn-plus {
    border-radius: 0 var(--app-radius-sm) var(--app-radius-sm) 0;
    border-left: none;
    color: var(--app-success);
}

.qty-control .qty-input {
    width: 36px;
    text-align: center;
    border-radius: 0;
    border: 1px solid var(--app-border);
    font-size: 0.85rem;
    padding: 0.15rem 0;
    height: 28px;
    -moz-appearance: textfield;
}

.qty-control .qty-input::-webkit-inner-spin-button,
.qty-control .qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-control .qty-input:focus {
    z-index: 1;
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px var(--app-primary-light);
}

/* ── Card Section Rows ──────────────────────────────────────────── */
.card-section-row td {
    padding: 1rem 1rem 0.35rem !important;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-secondary);
    border-bottom: 2px solid var(--app-border) !important;
    background: transparent !important;
}

.card-section-row:hover {
    background: transparent !important;
}

.app-table tbody tr.card-section-row:first-child td {
    padding-top: 0.25rem !important;
}

.card-section-count {
    font-weight: 600;
    opacity: 0.7;
}

/* ── Content area ───────────────────────────────────────────────── */
.content {
    padding-top: 1.5rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--app-success);
}

.invalid {
    outline: 1px solid var(--app-danger);
}

.validation-message {
    color: var(--app-danger);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.popover.bs-popover-auto {
  max-width: 270px !important;
}

.popover.bs-popover-auto .popover-body {
  max-height: 500px;
  overflow-y: auto;
}

.popover.bs-popover-auto .popover-body img {
  max-width: 250px;
  height: auto;
}

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--app-text-secondary);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h5 {
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 360px;
    margin: 0 auto;
}

/* ── Collection Page ───────────────────────────────────────────── */
.collection-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.collection-filters .filter-group {
    flex: 0 0 auto;
    width: 180px;
}

.collection-filters .filter-actions {
    flex: 0;
    min-width: auto;
    align-self: flex-end;
}

.collection-filters .filter-group-colors {
    flex: 0;
    min-width: auto;
}

.mana-color-filters {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.mana-filter-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--app-transition);
    padding: 0;
}

.mana-filter-btn:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
    background: var(--app-primary-light);
}

.mana-filter-btn.selected {
    border-color: var(--app-primary);
    color: var(--app-primary);
    background: var(--app-primary-light);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.mana-filter-btn i {
    font-size: 1rem;
}

/* Mana symbol colors */
.mana-filter-btn .ms-w { color: #f9faf4; text-shadow: 0 0 1px rgba(0,0,0,0.4); }
.mana-filter-btn .ms-u { color: #0e68ab; }
.mana-filter-btn .ms-b { color: #150b00; }
.mana-filter-btn .ms-r { color: #d3202a; }
.mana-filter-btn .ms-g { color: #00733e; }
.mana-filter-btn .ms-c { color: #ccc2c0; }

.mana-filter-btn.selected .ms-w { color: #f9faf4; }
.mana-filter-btn.selected .ms-u { color: #0e68ab; }
.mana-filter-btn.selected .ms-b { color: #150b00; }
.mana-filter-btn.selected .ms-r { color: #d3202a; }
.mana-filter-btn.selected .ms-g { color: #00733e; }
.mana-filter-btn.selected .ms-c { color: #ccc2c0; }

.collection-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collection-grid-card {
    overflow: hidden;
}

.collection-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.collection-grid thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--app-border);
    background: var(--app-bg);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.collection-grid thead th:nth-child(1),
.collection-grid tbody td:nth-child(1) {
    width: 30px;
    text-align: center;
}

.collection-grid thead th:nth-child(2),
.collection-grid tbody td:nth-child(2) {
    width: 170px;
}

.collection-grid thead th:nth-child(3),
.collection-grid tbody td:nth-child(3) {
    width: 120px;
    text-align: right;
}

.collection-grid thead th:nth-child(4),
.collection-grid tbody td:nth-child(4) {
    width: 54px;
    text-align: center;
}

.collection-grid thead th:nth-child(5),
.collection-grid tbody td:nth-child(5) {
    width: 66px;
    text-align: center;
}

.collection-grid thead th .col-options-button {
    color: var(--app-text-secondary);
    opacity: 0.6;
    transition: opacity var(--app-transition);
}

.collection-grid thead th .col-options-button:hover {
    opacity: 1;
}

.collection-grid tbody td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.collection-grid tbody tr:last-child td {
    border-bottom: none;
}

/* Hide blank placeholder rows rendered by QuickGrid when items < page size */
.collection-grid tbody tr:empty {
    display: none;
}

.collection-grid tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.collection-grid tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

.collection-grid tbody tr:nth-child(even):hover {
    background: rgba(99, 102, 241, 0.05);
}

.collection-mana-cost {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    width: 100%;
}

/* Quantity badges */
.qty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 0.15rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.qty-zero {
    background: rgba(239, 68, 68, 0.12);
    color: var(--app-danger);
}

.qty-full {
    background: rgba(16, 185, 129, 0.12);
    color: var(--app-success);
}

.qty-partial {
    background: rgba(245, 158, 11, 0.12);
    color: var(--app-warning);
}

/* Rarity pills */
.rarity-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.rarity-pill::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rarity-pill.rarity-common {
    background: rgba(17, 24, 39, 0.08);
    color: #374151;
}
.rarity-pill.rarity-common::before {
    background: #111827;
}

.rarity-pill.rarity-uncommon {
    background: rgba(192, 192, 192, 0.2);
    color: #6b7280;
}
.rarity-pill.rarity-uncommon::before {
    background: #c0c0c0;
}

.rarity-pill.rarity-rare {
    background: rgba(212, 175, 55, 0.12);
    color: #92700c;
}
.rarity-pill.rarity-rare::before {
    background: #d4af37;
}

.rarity-pill.rarity-mythic {
    background: rgba(211, 84, 0, 0.1);
    color: #d35400;
}
.rarity-pill.rarity-mythic::before {
    background: #d35400;
}

/* Paginator */
.collection-grid-card nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--app-border);
    background: var(--app-surface);
}

.collection-grid-card nav > :first-child {
    display: none;
}

.collection-grid-card nav .pagination-button,
.collection-grid-card nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
    cursor: pointer;
    transition: all var(--app-transition);
}

.collection-grid-card nav .pagination-button:hover,
.collection-grid-card nav button:hover {
    background: var(--app-primary-light);
    border-color: var(--app-primary);
    color: var(--app-primary);
}

.collection-grid-card nav .pagination-button:disabled,
.collection-grid-card nav button:disabled {
    opacity: 0.4;
    cursor: default;
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text-secondary);
}

.collection-grid-card nav span {
    font-size: 0.76rem;
    color: var(--app-text-secondary);
    padding: 0 0.25rem;
}

/* ── Deck Category Column ──────────────────────────────────────── */
.cat-header {
    width: 100px;
}

.cat-cell {
    padding: 0.4rem 0.6rem !important;
    white-space: nowrap;
    vertical-align: middle;
}

.cat-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cat-count {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.6;
    margin-left: 0.15rem;
}

.app-table tbody tr.cat-first-row:not(:first-child) td {
    border-top: 2px solid var(--app-border) !important;
}

/* ── Deck Owned Check/X ────────────────────────────────────────── */
.owned-check {
    color: var(--app-success);
    font-weight: 700;
    font-size: 1rem;
}

.owned-x {
    color: var(--app-danger);
    font-weight: 700;
    font-size: 1rem;
}

/* ── Deck Rarity Box ───────────────────────────────────────────── */
.rarity-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.rarity-box-rare {
    background: #d4af37;
}

.rarity-box-mythic {
    background: #d35400;
}

/* ── Summary Sections ──────────────────────────────────────────── */
.summary-section {
    margin-bottom: 1rem;
}

.summary-section:last-child {
    margin-bottom: 0;
}

.summary-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-primary);
    margin-bottom: 0.25rem;
}

.summary-section-content {
    color: var(--app-text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 0;
}

/* ── Wildcard Input ────────────────────────────────────────────── */
.wildcard-input {
    width: 44px !important;
}

/* ── Username Badge ────────────────────────────────────────────── */
.brand-icon {
    font-size: 1.3rem;
}

.username-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    background: var(--app-primary);
    color: #fff;
    border: none;
    white-space: nowrap;
    text-decoration: none;
}

a.username-badge:hover {
    color: #fff;
    background: var(--app-accent);
    text-decoration: none;
}

/* ── Mana Icons in public pages ────────────────────────────────── */
.deck-table .ms,
.app-card .ms {
    font-size: 0.9rem;
}