/* =====================================================================
   Colman Design System — Components
   Reusable UI components: badges, buttons, cards, wizard, inputs.
   ===================================================================== */

/* === Inline help system (shared across all pages) === */
.help-hint {
    display: inline-block;
    color: var(--bs-secondary-color);
    opacity: .5;
    font-size: .8em;
    cursor: help;
    transition: opacity .15s, color .15s;
    vertical-align: middle;
    margin-left: .3rem;
    line-height: 1;
}
.help-hint:hover { opacity: 1; color: var(--bs-info); }

/* Page-level help panel — static block, same visual as .tunnel-step, dashed border */
.page-help-panel {
    border: 2px dashed var(--bs-border-color);
    border-radius: .5rem;
    overflow: hidden;
    margin-bottom: var(--space-lg);
}
.page-help-header {
    padding: var(--space-lg) 1.25rem;
    background: var(--bs-secondary-bg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    user-select: none;
}
.page-help-header:hover { filter: brightness(1.1); }
.page-help-header .step-number {
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}
.page-help-chevron { transition: transform .2s; flex-shrink: 0; margin-left: auto; }
.page-help-header[aria-expanded="false"] .page-help-chevron { transform: rotate(180deg); }
.page-help-body {
    padding: var(--space-xl);
    background: var(--bs-tertiary-bg);
    font-size: var(--font-base);
    color: var(--bs-secondary-color);
}

/* Popover — fond du body en gris clair */
.popover {
    --bs-popover-bg: var(--bs-tertiary-bg);
    --bs-popover-body-color: var(--bs-secondary-color);
}

/* ? icon positioned inside a drop-zone (top-right corner) */
.drop-zone > .help-hint {
    position: absolute;
    top: .45rem;
    right: .55rem;
    font-size: .9rem;
}
.page-help-body p { margin-bottom: .35rem; }
.page-help-body ol { padding-left: 1.3rem; margin-bottom: 0; }
.page-help-body li { margin-bottom: .2rem; }
.page-help-body li:last-child { margin-bottom: 0; }

/* === Status badges === */
.app-badge-status {
    display: inline-block;
    font-size: var(--font-sm);
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 4px;
    line-height: 1;
    white-space: nowrap;
}
.app-badge-col  { background: var(--status-col-bg);  color: var(--status-col-text); }
.app-badge-stk  { background: var(--status-stk-bg);  color: var(--status-stk-text); }
.app-badge-tri  { background: var(--status-tri-bg);  color: var(--status-tri-text); }
.app-badge-list { background: var(--status-list-bg); color: var(--status-list-text); }
.app-badge-vte  { background: var(--status-vte-bg);  color: var(--status-vte-text); }

/* === Rarity dots === */
.app-rarity-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    vertical-align: middle;
}
.app-rarity-c { background-color: var(--rarity-common); }
.app-rarity-u { background-color: var(--rarity-uncommon); }
.app-rarity-r { background-color: var(--rarity-rare); }
.app-rarity-m { background-color: var(--rarity-mythic); }

/* === Foil price accent === */
.app-foil-price {
    color: var(--foil-color);
    font-weight: 600;
}

/* === Color filter buttons (MTG mana colors) === */
.app-color-btn {
    min-width: 38px;
    font-weight: 600;
    font-size: var(--font-sm);
    padding: var(--space-xs) var(--space-sm);
    transition: transform .1s, box-shadow .1s;
}
.app-color-btn.active {
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .5);
    transform: scale(1.1);
}

/* === Price input (editable in table/tile) === */
.app-price-input {
    width: 70px;
    text-align: right;
    font-size: var(--font-base);
}
.app-price-input::-webkit-outer-spin-button,
.app-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.app-price-input[type="number"] {
    -moz-appearance: textfield;
}

/* === Qty badge (bold when >= 4) === */
.app-qty-bold {
    font-weight: 700;
    color: var(--bs-danger);
}

/* === Wizard steps (export flow) === */
.app-wizard-step {
    opacity: .5;
    pointer-events: none;
    transition: opacity .2s;
}
.app-wizard-step.active {
    opacity: 1;
    pointer-events: auto;
}
.app-wizard-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-base);
}
.app-wizard-step.active .app-wizard-number {
    background: var(--bs-primary);
    color: #fff;
}
.app-wizard-step:not(.active) .app-wizard-number {
    background: var(--bs-secondary);
    color: #fff;
}

/* === Tile card header (common across all pages) === */
.app-tile-card-header {
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--bs-border-color);
}
.app-tile-card-name-fr {
    font-size: var(--font-md);
    font-weight: 500;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-tile-card-name-en {
    font-size: var(--font-sm);
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-tile-card-meta {
    font-size: var(--font-sm);
    color: var(--bs-secondary-color);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: 2px;
}
.app-tile-card-price {
    font-size: var(--font-base);
    font-weight: 600;
}

/* === Tile action zone (page-specific content below header) === */
.app-tile-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

/* === Per-page select (compact dropdown) === */
.app-select-compact {
    width: auto;
    font-size: var(--font-sm);
}

/* === Thumbnail (small card image in tables) === */
.app-thumb {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 3px;
}
.app-thumb-lg {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 3px;
}

/* =====================================================================
   Collection tile — specific styles for the collection card grid
   ===================================================================== */

/* === Collection tile grid === */
.card-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--tile-min-width), 1fr));
    gap: 8px;
    margin-bottom: var(--space-sm);
}

/* === Collection tile container === */
.card-tile {
    display: flex;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bs-body-bg);
    cursor: pointer;
    transition: box-shadow .18s, border-color .18s, transform .12s;
}
.card-tile:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
    transform: translateY(-1px);
}
[data-bs-theme="dark"] .card-tile:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
}

/* Tile with copies (entered highlight) */
.tile-entered {
    background-color: var(--highlight-entered-bg) !important;
    border-color: rgba(25,135,84,.4) !important;
}
.tile-entered:hover { border-color: rgba(25,135,84,.8) !important; }
[data-bs-theme="dark"] .tile-entered {
    background-color: rgba(25,135,84,.14) !important;
}

/* Foil tile — clearly visible yellow/golden background */
.tile-foil {
    background-color: rgba(255, 220, 80, .18) !important;
    border-color: rgba(212, 168, 67, .5) !important;
}
.tile-foil:hover {
    border-color: rgba(212, 168, 67, .8) !important;
}
[data-bs-theme="dark"] .tile-foil {
    background-color: rgba(212, 168, 67, .18) !important;
    border-color: rgba(212, 168, 67, .45) !important;
}

/* === Tile left column (image) === */
.tile-left {
    flex: 1; overflow: hidden;
    background: var(--bs-secondary-bg);
}
.tile-img-wrap { height: 100%; }
.tile-img {
    height: 100%; width: 100%;
    object-fit: cover; object-position: center top;
    display: block; transition: opacity .15s;
    border-radius: 8px 0 0 8px;
}
.tile-img-placeholder {
    width: 160px; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--bs-secondary-color); font-size: 2rem; opacity: .2;
}

/* Greyscale for cards without copies */
.tile-left.no-copy .tile-img {
    filter: grayscale(1); opacity: .45;
    transition: filter .3s ease, opacity .3s ease;
}
.tile-left.no-copy:hover .tile-img { filter: grayscale(0); opacity: 1; }

/* Flip button for DFC */
.tile-flip-btn {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px; padding: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.3);
    color: rgba(255,255,255,.85);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .15s;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
    font-size: var(--font-base);
}
.tile-flip-btn:hover { background: rgba(0,0,0,.85); color: #fff; transform: scale(1.1); }

/* === Tile info panel (right side) === */
.tile-info {
    flex: 1; min-width: 0;
    max-width: 240px;
    padding: .55rem .6rem;
    display: flex; flex-direction: column; gap: .4rem;
}

/* Header: name(s) + collector number */
.tile-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: .4rem; min-width: 0;
}
.tile-names { flex: 1; min-width: 0; overflow: hidden; }
.tile-name-fr {
    font-weight: 700; font-size: var(--font-md); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.tile-name-en {
    font-size: var(--font-sm); color: var(--bs-secondary-color);
    margin-top: .05rem;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.tile-cn-badge {
    flex-shrink: 0; font-size: .67rem; font-variant-numeric: tabular-nums;
    font-weight: 600; color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color);
    padding: .1rem .35rem; border-radius: 4px; line-height: 1.5; margin-top: .1rem;
    white-space: nowrap;
}
[data-bs-theme="dark"] .tile-cn-badge {
    background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12);
}

/* === Edition + price row === */
.tile-edition-row {
    display: flex; align-items: center; gap: .3rem;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--bs-border-color);
}
.tile-edition-row .tile-set-icon { height: 14px; opacity: .85; flex-shrink: 0; }
[data-bs-theme="dark"] .tile-edition-row .tile-set-icon { filter: brightness(0) invert(1); opacity: .8; }
.tile-edition-name {
    color: var(--bs-secondary-color); flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: var(--font-sm);
}
.tile-edition-prices {
    display: flex; gap: var(--space-sm); flex-shrink: 0;
    font-variant-numeric: tabular-nums; font-size: var(--font-sm);
}
.tile-edition-prices .price-foil { color: var(--foil-color); }
.tile-edition-prices span { font-size: var(--font-sm); }

/* === Copies table (status × regular/foil) === */
.tile-copies-table {
    width: 100%; font-size: .72rem; border-collapse: collapse;
}
.tile-copies-table th {
    font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--bs-secondary-color); padding: .18rem .3rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-size: .62rem; white-space: nowrap; text-align: center;
}
.tile-copies-table th:first-child { text-align: left; }
.tile-copies-table td {
    padding: .15rem .3rem; text-align: center; font-variant-numeric: tabular-nums;
}
.tile-copies-table td:first-child { text-align: left; }
.tile-copies-table tbody tr:nth-child(odd) { background: rgba(255,255,255,.07); }
.tile-copies-table tbody tr:nth-child(even) { background: transparent; }
[data-bs-theme="light"] .tile-copies-table tbody tr:nth-child(odd) { background: rgba(0,0,0,.05); }
.tile-copies-table .zero-cell { opacity: .2; }
.tile-copies-table .has-copies { font-weight: 700; color: var(--bs-body-color); }
.tile-copies-table .status-name { color: var(--bs-secondary-color); }
.tile-copies-table .status-name-highlight { font-weight: 700; color: var(--bs-body-color); }

/* === Tile action buttons === */
.tile-actions {
    display: flex; gap: .32rem; flex-wrap: wrap;
    padding-top: .38rem;
    border-top: 1px solid var(--bs-border-color);
    margin-top: auto; justify-content: center;
}
.tile-action-btn {
    font-size: .69rem; padding: .2rem .55rem; border-radius: 20px;
    border: 1px solid var(--bs-border-color);
    background: transparent; color: var(--bs-secondary-color);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.4; white-space: nowrap;
}
.tile-action-btn:hover {
    background: var(--bs-primary); color: #fff; border-color: var(--bs-primary);
}

/* === Legacy rarity dots (collection page) === */
.rarity-dot {
    display: inline-block; width: 7px; height: 7px;
    border-radius: 50%; flex-shrink: 0; margin-top: 3px;
}
.rarity-c { background: var(--rarity-common); }
.rarity-u { background: var(--rarity-uncommon); }
.rarity-r { background: var(--rarity-rare); }
.rarity-m { background: var(--rarity-mythic); }

/* === Legacy status badges (collection page) === */
.status-badges { display: flex; gap: 3px; flex-wrap: nowrap; }
.status-badge {
    font-size: var(--font-xs); padding: 1px 6px; border-radius: 999px;
    white-space: nowrap; font-weight: 600; letter-spacing: .02em;
}
.badge-col  { background: var(--status-col-bg);  color: var(--status-col-text); }
.badge-stk  { background: var(--status-stk-bg);  color: var(--status-stk-text); }
.badge-tri  { background: var(--status-tri-bg);  color: var(--status-tri-text); }
.badge-list { background: var(--status-list-bg); color: var(--status-list-text); }
.badge-vte  { background: var(--status-vte-bg);  color: var(--status-vte-text); }

/* === Price cells === */
.col-price { text-align: right; white-space: nowrap; }
.price-nm   { font-size: var(--font-base); font-variant-numeric: tabular-nums; }
.price-foil { font-size: var(--font-base); font-variant-numeric: tabular-nums; color: var(--foil-color); }

/* === Tile inline entry (qty +/- inputs) === */
.tile-entry {
    padding-top: .35rem; margin-top: .15rem;
    border-top: 1px solid var(--bs-border-color);
    display: flex; flex-direction: column; gap: 2px;
    align-items: center;
}
.tile-entry-labels {
    display: grid; grid-template-columns: 1fr 7px 1fr; width: 100%;
}
.tile-entry-labels span {
    font-size: .6rem; text-transform: uppercase; font-weight: 700;
    letter-spacing: .04em; color: var(--bs-secondary-color); text-align: center;
}
.tile-entry-labels .entry-sep-spacer { /* empty cell above separator */ }
.tile-entry-inputs {
    display: flex; gap: 0; width: 100%;
    justify-content: center; align-items: center;
}
.tile-entry-half {
    display: flex; align-items: center; gap: 2px;
    justify-content: center; flex: 1; position: relative;
}
.tile-entry-labels .tile-save-indicator { font-size: .6rem; margin-left: 1px; }
.tile-entry-sep {
    width: 1px; height: 20px;
    background: var(--bs-border-color); flex-shrink: 0; margin: 0 3px;
}
.tile-entry-row { display: flex; align-items: center; gap: 2px; }
.tile-entry-label { display: none; }
.tile-qty-group { display: flex; align-items: center; gap: 1px; }
.tile-qty-btn {
    width: 20px; height: 20px; padding: 0;
    font-size: var(--font-sm); line-height: 1;
    border-radius: 3px; flex-shrink: 0;
}
.tile-qty-input {
    width: 32px; text-align: center; padding: 0 2px;
    font-size: var(--font-sm); height: 20px; border-radius: 3px;
    -moz-appearance: textfield;
}
.tile-qty-input::-webkit-outer-spin-button,
.tile-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tile-save-indicator {
    width: 14px; display: inline-flex; align-items: center;
    justify-content: center; flex-shrink: 0; font-size: .6rem;
}
.tile-entry-focused {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px; border-radius: 10px;
}

/* === Set badge === */
.set-badge { font-size: var(--font-sm); color: var(--bs-secondary-color); white-space: nowrap; }

/* === Meta row (set pill + rarity + prices) === */
.tile-meta-row {
    display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
    padding: .28rem 0;
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}
.tile-set-pill {
    display: flex; align-items: flex-start; gap: .3rem;
    cursor: default; text-decoration: none !important;
    flex: 1; min-width: 0;
}
.tile-set-icon { height: 14px; display: block; opacity: .85; flex-shrink: 0; margin-top: 1px; }
[data-bs-theme="dark"] .tile-set-icon { filter: brightness(0) invert(1); opacity: .8; }
.tile-set-name-display {
    font-size: var(--font-sm); color: var(--bs-secondary-color); line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.tile-meta-dot {
    color: var(--bs-secondary-color); opacity: .3;
    font-size: var(--font-base); line-height: 1; display: none;
}
.tile-price-group {
    display: flex; align-items: center; gap: .4rem;
    margin-left: auto; padding-left: .55rem;
    border-left: 1px solid var(--bs-border-color);
}
.tile-price-item { display: flex; flex-direction: column; }
.tile-price-label {
    font-size: .57rem; text-transform: uppercase;
    letter-spacing: .06em; color: var(--bs-secondary-color); line-height: 1;
}
.tile-price-empty { font-size: var(--font-sm); color: var(--bs-secondary-color); }

/* === Dark mode status grid === */
[data-bs-theme="dark"] .tile-status-grid { background: rgba(255,255,255,.04); }

/* =====================================================================
   Card Entry — table-based mass entry screen
   ===================================================================== */

/* === Entry page background === */
#entry-page { transition: background-color .15s, color .15s; }
[data-bs-theme="dark"]  #entry-page { background-color: #1a1d21; color: #dee2e6; }
[data-bs-theme="light"] #entry-page { background-color: #f8f9fa; color: #212529; }

/* === Entry table === */
.entry-table { table-layout: fixed !important; width: 100% !important; }
.entry-table th {
    font-size: var(--font-base); text-transform: uppercase;
    letter-spacing: .04em; white-space: nowrap; overflow: hidden;
}
.entry-table td {
    vertical-align: middle; padding: .4rem .5rem; overflow: hidden;
}
.entry-table td.col-name {
    white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}

/* === Card thumbnail (entry table) === */
.card-thumb {
    width: 120px; height: auto; border-radius: 3px;
    object-fit: cover; cursor: zoom-in; transition: transform .15s;
}
.card-thumb:hover { transform: scale(1.05); }

/* === Card names (entry table) === */
.card-name-fr { font-weight: 500; font-size: var(--font-md); line-height: 1.2; }
.card-name-en { font-size: var(--font-sm); opacity: .55; line-height: 1.2; }

/* === Qty control (entry table) === */
.qty-group { display: flex; align-items: center; gap: 3px; }
.qty-btn {
    width: 26px; height: 26px; padding: 0;
    font-size: var(--font-md); line-height: 1;
    border-radius: 4px; flex-shrink: 0;
}
.qty-input {
    width: 42px; text-align: center; padding: 2px 4px;
    font-size: var(--font-md); height: 26px; border-radius: 4px;
    -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* === Row highlights (entry table) === */
[data-bs-theme="dark"]  .row-entered { background-color: rgba(25, 135, 84, .18) !important; }
[data-bs-theme="light"] .row-entered { background-color: rgba(25, 135, 84, .12) !important; }

/* === Save indicator === */
.save-indicator {
    width: 16px; display: inline-flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}

/* === Progress bar === */
.entry-progress { height: 22px; border-radius: 6px; }

/* === Set icon dark mode invert === */
[data-bs-theme="dark"] .set-icon { filter: invert(1); }

/* === Price badge === */
.price-badge { font-size: var(--font-base); }

/* === Variant rows (dimmed) === */
.row-variant td { opacity: .75; }
.row-variant.row-entered td { opacity: 1; }

/* =====================================================================
   Set progression cards
   ===================================================================== */
.set-card {
    transition: transform .12s, box-shadow .12s;
    cursor: pointer; text-decoration: none; color: inherit;
}
.set-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    color: inherit;
}
.set-icon { height: 48px; width: 48px; object-fit: contain; opacity: .85; }
.set-progress { height: 6px; border-radius: 3px; }
.pct-badge { font-size: var(--font-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.set-name  { font-weight: 600; font-size: var(--font-md); line-height: 1.2; }
.set-code  { font-size: .72rem; opacity: .55; text-transform: uppercase; letter-spacing: .05em; }

/* =====================================================================
   MKM Listing — legacy class aliases for listing table
   ===================================================================== */
.color-filter-btn { min-width: 38px; font-weight: 600; font-size: var(--font-sm); padding: var(--space-xs) var(--space-sm); }
.color-filter-btn.active { box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .5); transform: scale(1.1); }
.listing-table th { font-size: var(--font-sm); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.listing-table td { font-size: var(--font-base); vertical-align: middle; }
.listing-table .thumb { width: 40px; height: 56px; object-fit: cover; border-radius: 3px; }
.row-highlight-trend,
.card-tile.row-highlight-trend { background-color: var(--highlight-trend-bg) !important; border-color: rgba(25,135,84,.35) !important; }
.row-highlight-manual,
.card-tile.row-highlight-manual { background-color: var(--highlight-manual-bg) !important; border-color: rgba(13,110,253,.3) !important; }
.qty-bold { font-weight: 700; color: var(--bs-danger); }
.price-input { width: 70px; text-align: right; font-size: var(--font-base); }
.wizard-step { opacity: .5; pointer-events: none; }
.wizard-step.active { opacity: 1; pointer-events: auto; }
.wizard-step .step-number { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--font-base); }
.wizard-step.active .step-number { background: var(--bs-primary); color: #fff; }
.wizard-step:not(.active) .step-number { background: var(--bs-secondary); color: #fff; }
.summary-bar { font-size: var(--font-base); }

/* =====================================================================
   MKM Import — tunnel stepper + upload zone + validation table
   ===================================================================== */
.tunnel-step {
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    margin-bottom: var(--space-lg);
    overflow: hidden;
}
.tunnel-step-header {
    padding: var(--space-lg) 1.25rem;
    background: var(--bs-tertiary-bg);
    cursor: default;
    display: flex; align-items: center; gap: var(--space-md);
}
.tunnel-step-header .step-number {
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}
.tunnel-step.active .step-number { background: var(--bs-primary); color: var(--bs-white); }
.tunnel-step.done .step-number { background: var(--bs-success); color: var(--bs-white); }
.tunnel-step.disabled .tunnel-step-header { cursor: default; opacity: .55; }
.tunnel-step-title { flex-grow: 1; font-weight: 600; font-size: 1.05rem; }
.tunnel-step-summary { color: var(--bs-secondary-color); font-size: var(--font-base); }
.tunnel-step-body { padding: var(--space-xl); display: none; }
.tunnel-step.active .tunnel-step-body { display: block; }

/* Upload drop zone */
.drop-zone {
    border: 2px dashed var(--bs-border-color);
    border-radius: .5rem;
    padding: 2rem var(--space-lg);
    text-align: center; cursor: pointer;
    transition: border-color .2s, background-color .2s;
    position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}
.thumbnails { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }
.thumbnail {
    position: relative;
    width: 100px; height: 100px;
    border: 1px solid var(--bs-border-color);
    border-radius: .25rem; overflow: hidden;
}
.thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.thumbnail .remove-btn {
    position: absolute; top: 2px; right: 2px;
    background: rgba(0,0,0,.6); color: #fff;
    border: none; border-radius: 50%;
    width: 22px; height: 22px;
    line-height: 18px; font-size: 12px; cursor: pointer;
}

/* Validation table */
.validation-table th { white-space: nowrap; }
.validation-table .match-badge { font-size: var(--font-sm); }
.validation-table .thumb-mini { width: 50px; height: 70px; object-fit: cover; border-radius: .25rem; }
.match-ambiguous { background-color: var(--bs-warning-bg-subtle) !important; }
.match-not-found { background-color: var(--bs-danger-bg-subtle) !important; }

/* =====================================================================
   Transactions — detail modal (dark theme) + card thumbnails
   ===================================================================== */

/* Modal dark theme — uses [data-bs-theme] instead of hardcoded hex */
#transactionDetailModal .modal-content {
    background: var(--bs-body-bg);
    border: 2px solid var(--bs-primary);
    border-radius: .5rem;
    color: var(--bs-body-color);
}
#transactionDetailModal .modal-header,
#transactionDetailModal .modal-footer {
    border-color: var(--bs-border-color);
}
#transactionDetailModal .btn-close { filter: invert(1); }
#transactionDetailModal .text-muted { color: var(--bs-secondary-color) !important; }
#transactionDetailModal .card {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
}
#transactionDetailModal .card-header {
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
}
#transactionDetailModal table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(var(--bs-body-color-rgb), .04);
    color: var(--bs-body-color);
}
#transactionDetailModal th {
    color: var(--bs-secondary-color);
    border-color: var(--bs-border-color) !important;
}
#transactionDetailModal td {
    border-color: var(--bs-border-color) !important;
    vertical-align: middle;
}
#transactionDetailModal .table-hover tbody tr:hover td {
    background: rgba(var(--bs-body-color-rgb), .06) !important;
}
#transactionDetailModal code {
    background: var(--bs-tertiary-bg);
    color: var(--bs-danger);
    padding: .1em .4em;
    border-radius: .25rem;
}

/* Card thumbnail with hover zoom */
.tx-card-thumb {
    width: 46px; height: 64px;
    border-radius: 4px; object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
    cursor: zoom-in;
    transition: transform .2s ease, box-shadow .2s ease;
    transform-origin: left center;
    position: relative; z-index: 1;
}
.tx-card-thumb:hover {
    transform: scale(5); z-index: 1060;
    box-shadow: 0 10px 40px rgba(0,0,0,.8);
    border: 2px solid var(--bs-primary);
}
.tx-card-thumb-wrapper {
    display: inline-block;
    width: 46px; height: 64px;
    position: relative;
}
.tx-no-thumb {
    width: 46px; height: 64px;
    border-radius: 4px;
    background: var(--bs-tertiary-bg);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--bs-secondary-color);
}

/* =====================================================================
   Scheduled Tasks — job cards, live zone, execution table
   ===================================================================== */
.job-card { transition: box-shadow .15s; }
.job-card:hover { box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), .35); }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cron-input { font-family: monospace; font-size: var(--font-base); width: 14ch; }
.exec-table td,
.exec-table th { font-size: var(--font-base); vertical-align: middle; padding: .3rem .5rem; }
.log-pre {
    font-size: var(--font-sm); max-height: 60vh; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
    background: var(--bs-dark-bg-subtle, #1e1e1e); color: var(--bs-body-color);
}
.category-badge { font-size: var(--font-sm); text-transform: uppercase; letter-spacing: .05em; }
.trigger-btn { white-space: nowrap; }

/* Live zone */
#running-zone { border-left: 4px solid var(--bs-primary); }
.running-item { display: flex; align-items: center; gap: var(--space-md); padding: .35rem 0; }
.running-item + .running-item { border-top: 1px solid rgba(var(--bs-primary-rgb), .15); }
.elapsed { font-variant-numeric: tabular-nums; font-family: monospace; font-size: var(--font-base); }

/* Pulse animation for running dot */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.dot-pulse { animation: pulse 1.5s ease-in-out infinite; }

/* =====================================================================
   Card detail popup — theme-aware modal
   ===================================================================== */
#card-detail-content {
    color: var(--bs-body-color);
}
#card-detail-content .modal-header { color: var(--bs-body-color); }
#card-detail-content .nav-tabs { border-bottom: 2px solid var(--bs-border-color); }
#card-detail-content .nav-link {
    color: var(--bs-secondary-color); border: 1px solid transparent;
    border-radius: .375rem .375rem 0 0; margin-bottom: -2px;
    padding: .45rem .85rem; font-size: .88rem;
}
#card-detail-content .nav-link.active {
    background: var(--bs-secondary-bg); color: var(--bs-body-color);
    border-color: var(--bs-border-color) var(--bs-border-color) var(--bs-secondary-bg);
    border-top: 2px solid var(--bs-primary); margin-bottom: -2px;
}
#card-detail-content .nav-link:hover:not(.active) {
    color: var(--bs-body-color); background: var(--bs-tertiary-bg); border-color: transparent;
}
#card-detail-content .text-muted { color: var(--bs-secondary-color) !important; }
#card-detail-content .border { border-color: var(--bs-border-color) !important; }
#card-detail-content .bg-body-secondary { background: var(--bs-tertiary-bg) !important; }
#card-detail-content table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(var(--bs-body-color-rgb), .04);
    color: var(--bs-body-color);
}
#card-detail-content th { color: var(--bs-secondary-color); border-color: var(--bs-border-color) !important; }
#card-detail-content td { border-color: var(--bs-border-color) !important; }
#card-detail-content .table-hover tbody tr:hover td { background: rgba(var(--bs-body-color-rgb), .06) !important; }
#card-detail-content .form-control {
    background: var(--bs-body-bg); border-color: var(--bs-border-color); color: var(--bs-body-color);
}
#card-detail-content .form-control:focus {
    background: var(--bs-body-bg); color: var(--bs-body-color); border-color: var(--bs-primary); box-shadow: none;
}
#card-detail-content .form-select {
    background-color: var(--bs-body-bg); color: var(--bs-body-color); border-color: var(--bs-border-color);
}
#card-detail-content .form-select:focus {
    background-color: var(--bs-body-bg); color: var(--bs-body-color); border-color: var(--bs-primary); box-shadow: none;
}
[data-bs-theme="dark"] #card-detail-content .btn-close { filter: invert(1); }

/* Copies matrix */
.to-sort-cell { background: rgba(255,193,7,.07) !important; }
.to-sort-hd { color: #ffc107 !important; font-weight: 700; }
.status-sep { border-left: 2px solid rgba(255,255,255,.18) !important; }
@keyframes spin-cd { to { transform: rotate(360deg); } }
.spin-cd { display: inline-block; animation: spin-cd .7s linear infinite; }

/* Card variant thumbnails */
.card-variant-thumb {
    height: 80px; width: auto; border-radius: 6px; cursor: pointer;
    opacity: .75; transition: opacity .15s, transform .15s, box-shadow .15s;
    border: 2px solid transparent;
}
.card-variant-thumb:hover {
    opacity: 1; transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(0,0,0,.4); border-color: var(--bs-primary);
}

/* Navigation arrows */
.card-nav-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 1060;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color); font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .15s;
}
.card-nav-arrow:hover:not(:disabled) {
    background: var(--bs-secondary-bg); color: var(--bs-body-color); border-color: var(--bs-primary);
}
.card-nav-arrow:disabled { cursor: default; }
.card-nav-arrow.nav-prev { left: -56px; }
.card-nav-arrow.nav-next { right: -56px; }
