/* ============================================================
   TCGEx Tracker — Huddle.is-style standalone app layout
   ============================================================ */

html { overflow-x: hidden; }

body.tracker-app {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background-color: #f4f7fb;
    padding-bottom: 40px; /* space for fixed footer */
}

/* ── Wrapper ─────────────────────────────────────────────── */
.hm-wrapper {
    width: 100%;
    max-width: 640px;
    min-width: 320px;
    margin: 16px auto 16px auto;
}

/* ── Card container ─────────────────────────────────────── */
.hm-bottom {
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    overflow: hidden; /* fallback for older browsers */
    overflow: clip;   /* clip does not trap position:fixed children (Safari 16+) */
}

/* ── Header ─────────────────────────────────────────────── */
.hm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f2f5;
    min-height: 56px;
}

.hm-wallet-area {
    display: flex;
    align-items: center;
}

.hm-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.hm-brand-icon {
    width: 34px;
    height: 34px;
    background: #3f78e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.5px;
    margin-right: 8px;
    flex-shrink: 0;
    font-family: inherit;
}

.hm-brand {
    font-size: 18px;
    font-weight: 700;
    color: #1e2230;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.hm-brand span { color: #3f78e0; }

.hm-brand small {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: #aab1c0;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ── Header nav icons ─────────────────────────────────── */
.hm-navbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hm-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #6c7a92;
    font-size: 18px;
    text-decoration: none;
    transition: background .15s, color .15s;
    cursor: pointer;
}

.hm-nav-icon:hover { background: #f0f3f8; color: #3f78e0; }

.hm-currency-trigger {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #6c7a92;
    padding: 0 4px;
    min-width: 40px;
    text-align: center;
}

/* ── Content area ─────────────────────────────────────── */
.hm-content {
    padding: 20px 20px 24px;
}

/* ── Portfolio total (big number) ─────────────────────── */
.hm-teaser-container {
    position: relative;
    margin-bottom: 20px;
}

.hm-teaser {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.hm-content-value {
    font-size: 48px;
    font-weight: 700;
    color: #1e2230;
    letter-spacing: -2px;
    line-height: 1;
    min-height: 52px;
}

.hm-content-unit {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.hm-teaser-unit {
    font-size: 14px;
    color: #aab1c0;
    font-weight: 600;
    letter-spacing: .04em;
}

.hm-teaser-bottom {
    margin-top: 6px;
}

.hm-card-count {
    font-size: 13px;
    color: #aab1c0;
}

/* ── Guest banner ─────────────────────────────────────── */
.hm-guest-banner {
    background: #eef3fc;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #4a6190;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hm-guest-banner i { flex-shrink: 0; }

.hm-guest-banner a {
    margin-left: auto;
    font-weight: 600;
    color: #3f78e0;
    text-decoration: none;
    white-space: nowrap;
}

.hm-guest-banner a:hover { text-decoration: underline; }

/* ── Dividers ─────────────────────────────────────────── */
.hm-hr {
    height: 1px;
    background: #edf1f7;
    margin: 16px 0;
}

.hm-hr-sm {
    height: 1px;
    background: #f3f5f9;
    margin: 10px 0;
}

/* ── Search ───────────────────────────────────────────── */
.hm-search-wrap {
    position: relative;
    margin-bottom: 4px;
}

.hm-search-inner {
    display: flex;
    align-items: center;
    background: #f4f7fb;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    padding: 8px 14px;
    transition: border-color .15s, box-shadow .15s;
}

.hm-search-inner:focus-within {
    border-color: #3f78e0;
    box-shadow: 0 0 0 3px rgba(63,120,224,.12);
    background: #fff;
}

.hm-search-icon {
    color: #aab1c0;
    font-size: 18px;
    margin-right: 8px;
    flex-shrink: 0;
}

.hm-search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px; /* 16px prevents iOS Safari auto-zoom on focus */
    color: #1e2230;
    width: 100%;
}

.hm-search-input::placeholder { color: #b8c0ce; }

.hm-search-sep {
    width: 1px;
    height: 18px;
    background: #dde1e9;
    flex-shrink: 0;
    margin: 0 4px;
}

.hm-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    z-index: 1050;
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #e8edf5;
}

.hm-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f4f5f8;
    transition: background .12s;
    text-align: left;
    width: 100%;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.hm-search-result-item:last-child { border-bottom: none; }
.hm-search-result-item:hover { background: #f6f9ff; }

.hm-search-result-img {
    width: 34px;
    height: 46px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.hm-search-result-img-placeholder {
    width: 34px;
    height: 46px;
    background: #edf1f7;
    border-radius: 5px;
    flex-shrink: 0;
}

.hm-search-msg {
    padding: 14px 16px;
    font-size: 13px;
    color: #aab1c0;
}

/* ── Collection list ──────────────────────────────────── */
.hm-collection-list {}

.list-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 6px;
}

.header-left, .header-right {
    font-size: 12px;
    color: #aab1c0;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.header-left { flex: 1; }
.header-right { width: 108px; text-align: right; flex-shrink: 0; }

.list-body-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f5f9;
    cursor: pointer;
    border-radius: 4px;
    transition: background .12s;
}

.list-body-row:hover { background: #f8fafd; }

.list-body-row:last-child { border-bottom: none; }

/* Col 1 — card info */
.list-body-left {
    flex: 1;
    min-width: 0;
}

.list-body-l-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Col 2 — total + qty controls */
.list-body-right {
    width: 108px;
    text-align: right;
    flex-shrink: 0;
}

.collection-img img {
    width: 46px;
    height: 62px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid #e8edf5;
    flex-shrink: 0;
}

.collection-img-placeholder {
    width: 46px;
    height: 62px;
    background: #edf1f7;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c0c8d8;
    font-size: 18px;
    flex-shrink: 0;
}

.tracker-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e2230;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.collection-qty {
    font-size: 12px;
    color: #aab1c0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.condition-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 20px;
    background: #edf1f7;
    color: #6c7a92;
}

.list-body-right {
    text-align: right;
    flex-shrink: 0;
    margin-left: 8px;
}

.tracker-unit-price {
    font-size: 14px;
    font-weight: 600;
    color: #1e2230;
    white-space: nowrap;
}

.price-status-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 20px;
    font-weight: 600;
}

.price-live    { background: #e2f5e9; color: #1a8a42; }
.price-cached  { background: #edf1f7; color: #6c7a92; }
.price-stale   { background: #fff8e1; color: #b07c00; }
.price-unavail { background: #fdecea; color: #c0392b; }

.collection-total {
    font-size: 15px;
    font-weight: 700;
    color: #1e2230;
    white-space: nowrap;
}

/* Unit price + qty shown inside the info row */
.qty-unit-price {
    color: #6c7a92;
    font-weight: 600;
    white-space: nowrap;
}

.qty-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #6c7a92;
    font-weight: 600;
    white-space: nowrap;
}

.qty-count i { font-size: 11px; }

.tracker-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.hm-qty-input {
    width: 54px;
    height: 26px;
    border: 1px solid #e4e9f2;
    border-radius: 7px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #1e2230;
    background: #f4f7fb;
    outline: none;
    transition: border-color .15s;
}

.hm-qty-input:focus {
    border-color: #3f78e0;
    background: #fff;
}

.hm-remove-btn {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    background: #fdecea;
    color: #c0392b;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.hm-remove-btn:hover { background: #fbd5d2; }

/* ── Empty state ──────────────────────────────────────── */
.hm-empty {
    text-align: center;
    padding: 40px 20px;
}

.hm-empty-icon {
    font-size: 40px;
    color: #c8d2e0;
    display: block;
    margin-bottom: 12px;
}

.hm-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #6c7a92;
    margin-bottom: 4px;
}

.hm-empty-desc {
    font-size: 13px;
    color: #aab1c0;
}

/* ── Fixed footer bar ─────────────────────────────────── */
.hm-footer {
    position: fixed;
    width: 100%;
    height: 32px;
    bottom: 0;
    background: #1e2230;
    z-index: 500;
}

.hm-footer-content {
    max-width: 640px;
    margin: 0 auto;
    height: 32px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    font-size: 11px;
    color: rgba(255,255,255,.4);
}

.hm-footer-content-l {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
}

.hm-footer-content-r {
    text-align: right;
}

.hm-footer-content a { color: rgba(255,255,255,.5); text-decoration: none; }
.hm-footer-content a:hover { color: rgba(255,255,255,.8); }

/* ── Page nav (Tracker / Wishlist tabs) ───────────────── */
.hm-page-nav {
    display: flex;
    padding: 0 8px;
    border-bottom: 1px solid #f0f2f5;
    background: #fff;
}
.hm-page-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #96a0b0;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
}
.hm-page-nav-item.active { color: #3f78e0; border-bottom-color: #3f78e0; }
.hm-page-nav-item:hover:not(.active) { color: #4a5a7a; }

/* ── Dark mode ────────────────────────────────────────── */
body.tracker-app.dark-mode { background-color: #0f1117; }

.dark-mode .hm-bottom {
    background: #16192b;
    box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

.dark-mode .hm-header { border-bottom-color: rgba(255,255,255,.06); }
.dark-mode .hm-page-nav { background: #1a1d28; border-bottom-color: rgba(255,255,255,.06); }
.dark-mode .hm-page-nav-item { color: #4a5570; }
.dark-mode .hm-page-nav-item.active { color: #4a7de0; border-bottom-color: #4a7de0; }
.dark-mode .hm-page-nav-item:hover:not(.active) { color: #8090a8; }
.dark-mode .hm-search-sep { background: rgba(255,255,255,.1); }

.dark-mode .hm-brand { color: #e0e5f0; }
.dark-mode .hm-brand small { color: #556070; }

.dark-mode .hm-nav-icon { color: #6c7a92; }
.dark-mode .hm-nav-icon:hover { background: rgba(255,255,255,.06); color: #a0b0d0; }

.dark-mode .hm-content-value { color: #dce3f0; }
.dark-mode .hm-card-count { color: #556070; }
.dark-mode .hm-teaser-unit { color: #556070; }

.dark-mode .hm-guest-banner {
    background: rgba(63,120,224,.12);
    color: #7a9cc8;
}
.dark-mode .hm-guest-banner a { color: #7ab3ff; }

.dark-mode .hm-hr { background: rgba(255,255,255,.06); }
.dark-mode .hm-hr-sm { background: rgba(255,255,255,.04); }

.dark-mode .hm-search-inner {
    background: #1e2235;
    border-color: rgba(255,255,255,.08);
}
.dark-mode .hm-search-inner:focus-within {
    border-color: #3f78e0;
    background: #1e2235;
}
.dark-mode .hm-search-icon { color: #556070; }
.dark-mode .hm-search-input { color: #dce3f0; }
.dark-mode .hm-search-input::placeholder { color: #3d4a5e; }
.dark-mode .hm-search-results {
    background: #1a1d2e;
    border-color: rgba(255,255,255,.08);
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.dark-mode .hm-search-result-item { border-bottom-color: rgba(255,255,255,.05); }
.dark-mode .hm-search-result-item:hover { background: rgba(63,120,224,.08); }
.dark-mode .hm-search-msg { color: #556070; }

.dark-mode .header-left,
.dark-mode .header-right { color: #4a5570; }

.dark-mode .list-body-row { border-bottom-color: rgba(255,255,255,.05); }
.dark-mode .collection-img img { border-color: rgba(255,255,255,.08); }
.dark-mode .collection-img-placeholder { background: #252840; color: #3d4a5e; }
.dark-mode .tracker-card-name { color: #dce3f0; }
.dark-mode .collection-qty { color: #4a5570; }
.dark-mode .condition-badge { background: #252840; color: #7a8aa0; }
.dark-mode .tracker-unit-price { color: #dce3f0; }
.dark-mode .collection-total { color: #dce3f0; }
.dark-mode .qty-unit-price  { color: #7a8aa0; }
.dark-mode .qty-count        { color: #7a8aa0; }

.dark-mode .hm-qty-input {
    background: #1e2235;
    border-color: rgba(255,255,255,.08);
    color: #dce3f0;
}
.dark-mode .hm-qty-input:focus {
    border-color: #3f78e0;
    background: #1e2235;
}
.dark-mode .hm-remove-btn { background: rgba(192,57,43,.2); color: #e07060; }
.dark-mode .hm-remove-btn:hover { background: rgba(192,57,43,.35); }

.dark-mode .hm-empty-icon { color: #2a3248; }
.dark-mode .hm-empty-title { color: #4a5570; }
.dark-mode .hm-empty-desc { color: #3a4458; }

.dark-mode .hm-footer { background: #0d0f18; }

/* ── Modal dark mode ──────────────────────────────────── */
.dark-mode .modal-content {
    background: #1a1d2e;
    color: #dce3f0;
    border-color: rgba(255,255,255,.08);
}
.dark-mode .modal-content .btn-close { filter: invert(1); }
.dark-mode .modal-content .form-select,
.dark-mode .modal-content .form-control {
    background: #1e2235;
    border-color: rgba(255,255,255,.1);
    color: #dce3f0;
}
.dark-mode .modal-content .form-label { color: #9ab0c8; }
.dark-mode .modal-backdrop { background: rgba(0,0,0,.75); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 680px) {
    .hm-wrapper {
        margin: 0;
        min-width: 0;
    }
    .hm-bottom {
        border-radius: 0;
        box-shadow: none;
        min-height: calc(100vh - 32px);
    }
    .hm-footer-content { max-width: 100%; }
    .tracker-card-name { max-width: 130px; }
}

@media (max-width: 380px) {
    .hm-content { padding: 16px 14px 20px; }
    .hm-header { padding: 12px 14px; }
    .hm-content-value { font-size: 38px; }
    .tracker-card-name { max-width: 100px; }
}

/* ── Currency label (header, read-only) ───────────────── */
.hm-currency-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    color: #6c7a92;
    cursor: default;
    min-width: 36px;
    justify-content: center;
}

/* ── Settings Offcanvas ───────────────────────────────── */
.tracker-offcanvas {
    background-color: #1a1d2e;
    color: #c8d2e8;
    width: 300px !important;
}

.tracker-offcanvas .offcanvas-header {
    border-bottom: 1px solid rgba(255,255,255,.07);
    padding: 18px 20px;
}

.tracker-offcanvas .offcanvas-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.tracker-offcanvas .offcanvas-body {
    padding: 6px 0 40px;
}

/* Widget blocks */
.toc-widget {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.toc-widget:last-child { border-bottom: none; }

.toc-widget-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    margin-bottom: 12px;
}

/* Option pills (currency / language) */
.toc-option-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toc-option-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.55);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    cursor: pointer;
}

.toc-option-pill:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.toc-option-pill.selected {
    background: rgba(63,120,224,.25);
    border-color: #3f78e0;
    color: #7ab3ff;
}

/* Link rows (account) */
.toc-link-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    font-size: 14px;
    transition: background .12s, color .12s;
}

.toc-link i { font-size: 16px; }
.toc-link:hover { background: rgba(255,255,255,.07); color: #fff; }

/* Description text */
.toc-desc {
    font-size: 13px;
    color: rgba(255,255,255,.35);
    line-height: 1.6;
    margin: 0;
}

.toc-desc strong { color: rgba(255,255,255,.55); }

/* Nav links */
.toc-nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    font-size: 14px;
    transition: background .12s, color .12s;
}

.toc-nav-links a i { font-size: 16px; }
.toc-nav-links a:hover { background: rgba(255,255,255,.07); color: #fff; }

/* Offcanvas backdrop */
.offcanvas-backdrop { background-color: rgba(0,0,0,.6); }

/* Light mode: offcanvas stays dark (intentional, like Huddle) */

/* ── List body left ──────────────────────────────────── */
.list-body-left { flex: 1; min-width: 0; }

/* ── Short total (tap to expand) ─────────────────────── */
.hm-total-wrap { cursor: pointer; user-select: none; }
.hm-total-wrap .total-full { display: none; }
.hm-total-wrap.expanded .total-short { display: none; }
.hm-total-wrap.expanded .total-full { display: inline; }

/* ── Countdown bar (Pro) ─────────────────────────────── */
.hm-countdown-bar {
    height: 2px;
    background: rgba(63,120,224,.1);
    position: relative;
    overflow: hidden;
    margin: -1px -20px 0;
}
.hm-countdown-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, #3f78e0, #7ab3ff);
    transform-origin: left center;
}
.hm-countdown-bar.animate::before {
    animation: countdownLTR 5s linear forwards;
}
@keyframes countdownLTR {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ── Series groups ────────────────────────────────────── */
.series-group { margin-bottom: 2px; }

.series-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 6px;
    cursor: pointer;
    border-bottom: 1px solid #edf1f7;
    user-select: none;
    transition: opacity .12s;
}
.series-group-header:hover { opacity: .75; }

.series-group-code {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #3f78e0;
    background: rgba(63,120,224,.1);
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}

.series-group-count {
    font-size: 12px;
    color: #aab1c0;
    flex: 1;
}

.series-subtotal {
    font-size: 12px;
    font-weight: 600;
    color: #6c7a92;
}

.series-chevron {
    font-size: 16px;
    color: #aab1c0;
    transition: transform .2s;
    flex-shrink: 0;
}

.series-group.collapsed .series-chevron { transform: rotate(-90deg); }
.series-group.collapsed .series-group-body { display: none; }

/* ── +/- qty controls ─────────────────────────────────── */
.hm-qty-ctrl {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.hm-qty-btn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid #e4e9f2;
    background: #f4f7fb;
    color: #6c7a92;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
    flex-shrink: 0;
    padding: 0;
}

.hm-qty-btn:hover { background: #e4e9f2; color: #1e2230; }
.hm-qty-btn.dec:hover { background: #fdecea; color: #c0392b; border-color: #f5c6c3; }

.hm-qty-display {
    min-width: 24px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #1e2230;
}

/* ── SELL placeholder button ──────────────────────────── */
.hm-sell-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px dashed #c8d2e0;
    background: transparent;
    color: #b8c0ce;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    letter-spacing: .03em;
}
.hm-sell-btn:hover {
    border-color: #3f78e0;
    color: #3f78e0;
    background: rgba(63,120,224,.05);
}
.hm-sell-btn i { font-size: 11px; }

/* ── Price highlight animation ─────────────────────────── */
@keyframes priceHighlight {
    0%   { background-color: rgba(63,120,224,.18); border-radius: 4px; }
    100% { background-color: transparent; }
}
.price-updating {
    animation: priceHighlight .65s ease-out;
}

/* ── Search actions row ───────────────────────────────── */
.hm-search-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 8px;
    margin-bottom: 2px;
}

/* ── Bulk add button ──────────────────────────────────── */
.hm-bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid #e4e9f2;
    background: #f4f7fb;
    color: #6c7a92;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, color .12s;
    text-decoration: none;
}
.hm-bulk-btn:hover { background: #edf1f7; color: #1e2230; }

/* ── Bulk confirm table ───────────────────────────────── */
.bulk-confirm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.bulk-confirm-table th {
    font-size: 11px;
    font-weight: 700;
    color: #aab1c0;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 4px 6px 8px;
    text-align: left;
    border-bottom: 1px solid #edf1f7;
    white-space: nowrap;
}
.bulk-confirm-table td {
    padding: 6px 4px;
    border-bottom: 1px solid #f4f5f8;
    vertical-align: middle;
}
.bulk-confirm-table tr:last-child td { border-bottom: none; }
.bulk-row-code { font-weight: 600; color: #1e2230; white-space: nowrap; }
.bulk-row-name { color: #6c7a92; font-size: 12px; }
.bulk-row-notfound { color: #e07060; font-size: 12px; }

/* ── Dark mode additions ──────────────────────────────── */
.dark-mode .hm-countdown-bar { background: rgba(63,120,224,.08); }

.dark-mode .series-group-header { border-bottom-color: rgba(255,255,255,.05); }
.dark-mode .series-group-code { color: #7ab3ff; background: rgba(63,120,224,.15); }
.dark-mode .series-group-count { color: #4a5570; }
.dark-mode .series-subtotal { color: #7a8aa0; }
.dark-mode .series-chevron { color: #4a5570; }

.dark-mode .hm-qty-btn { background: #1e2235; border-color: rgba(255,255,255,.08); color: #7a8aa0; }
.dark-mode .hm-qty-btn:hover { background: #252840; color: #dce3f0; border-color: rgba(255,255,255,.15); }
.dark-mode .hm-qty-btn.dec:hover { background: rgba(192,57,43,.2); color: #e07060; border-color: transparent; }
.dark-mode .hm-qty-display { color: #dce3f0; }

.dark-mode .hm-sell-btn { border-color: rgba(255,255,255,.1); color: #3a4458; }
.dark-mode .hm-sell-btn:hover { border-color: #3f78e0; color: #7ab3ff; background: rgba(63,120,224,.08); }

.dark-mode .hm-bulk-btn { background: #1e2235; border-color: rgba(255,255,255,.08); color: #7a8aa0; }
.dark-mode .hm-bulk-btn:hover { background: #252840; color: #dce3f0; }

.dark-mode .bulk-confirm-table th { color: #4a5570; border-bottom-color: rgba(255,255,255,.06); }
.dark-mode .bulk-confirm-table td { border-bottom-color: rgba(255,255,255,.04); }
.dark-mode .bulk-row-code { color: #dce3f0; }
.dark-mode .bulk-row-name { color: #7a8aa0; }

/* ── Mobile additions ─────────────────────────────────── */
@media (max-width: 680px) {
    .hm-sell-btn { display: none; }
    .tracker-card-name { max-width: 140px; }
}

/* ── Price change indicator (in row right col) ─────────── */
.price-change {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 2px;
    line-height: 1.2;
}
.price-change.up   { color: #1a8a42; }
.price-change.down { color: #c0392b; }
.price-change.flat { color: #aab1c0; }

/* ── Card detail modal ─────────────────────────────────── */
.det-modal-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 14px;
}

.det-card-img img {
    width: 54px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e8edf5;
    flex-shrink: 0;
}

.det-card-img-ph {
    width: 54px;
    height: 72px;
    background: #edf1f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c0c8d8;
    font-size: 20px;
    flex-shrink: 0;
}

.det-card-meta { flex: 1; min-width: 0; }

.det-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #1e2230;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.det-card-sub {
    font-size: 12px;
    color: #aab1c0;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.det-price-block {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 2px;
}

.det-unit-price {
    font-size: 28px;
    font-weight: 700;
    color: #1e2230;
    letter-spacing: -.5px;
    line-height: 1;
}

.det-change-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}
.det-change-badge.up   { background: #e2f5e9; color: #1a8a42; }
.det-change-badge.down { background: #fdecea; color: #c0392b; }
.det-change-badge.flat { background: #edf1f7; color: #aab1c0; }

.det-sparkline-wrap {
    height: 62px;
    margin: 12px 0;
    position: relative;
    overflow: hidden;
}

.det-sparkline-wrap svg {
    width: 100%;
    height: 100%;
}

.det-sparkline-msg {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #aab1c0;
}

.det-sparkline-pro-gate {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #aab1c0;
    gap: 5px;
}

.det-sparkline-pro-gate a {
    color: #3f78e0;
    font-weight: 600;
    text-decoration: none;
}

.det-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    margin: 12px 0;
}

.det-qty-label {
    font-size: 13px;
    color: #6c7a92;
    font-weight: 600;
}

.det-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}

.det-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid #e4e9f2;
    background: #f4f7fb;
    color: #6c7a92;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
    flex-shrink: 0;
    padding: 0;
}

.det-qty-btn:hover { background: #e4e9f2; color: #1e2230; }
.det-qty-btn.dec:hover { background: #fdecea; color: #c0392b; border-color: #f5c6c3; }

.det-qty-num {
    font-size: 18px;
    font-weight: 700;
    color: #1e2230;
    min-width: 30px;
    text-align: center;
}

.det-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.det-total-label {
    font-size: 13px;
    color: #6c7a92;
}

.det-total-val {
    font-size: 20px;
    font-weight: 700;
    color: #1e2230;
}

.det-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px;
    border-radius: 10px;
    border: 1px solid #f5c6c3;
    background: #fdecea;
    color: #c0392b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.det-remove-btn:hover { background: #fbd5d2; border-color: #e57060; }

/* ── Dark mode: row hover + price change ─────────────────── */
.dark-mode .list-body-row:hover { background: rgba(255,255,255,.025); }
.dark-mode .price-change.up   { color: #4cbb7a; }
.dark-mode .price-change.down { color: #e07060; }
.dark-mode .price-change.flat { color: #4a5570; }

/* ── Dark mode: detail modal ─────────────────────────────── */
.dark-mode .det-modal-card { border-bottom-color: rgba(255,255,255,.07); }
.dark-mode .det-card-img img { border-color: rgba(255,255,255,.1); }
.dark-mode .det-card-img-ph { background: #252840; color: #3d4a5e; }
.dark-mode .det-card-name { color: #dce3f0; }
.dark-mode .det-unit-price { color: #dce3f0; }
.dark-mode .det-qty-row { border-color: rgba(255,255,255,.06); }
.dark-mode .det-qty-label { color: #7a8aa0; }
.dark-mode .det-qty-btn { background: #1e2235; border-color: rgba(255,255,255,.08); color: #7a8aa0; }
.dark-mode .det-qty-btn:hover { background: #252840; color: #dce3f0; }
.dark-mode .det-qty-btn.dec:hover { background: rgba(192,57,43,.2); color: #e07060; border-color: transparent; }
.dark-mode .det-qty-num { color: #dce3f0; }
.dark-mode .det-total-label { color: #7a8aa0; }
.dark-mode .det-total-val { color: #dce3f0; }
.dark-mode .det-remove-btn { background: rgba(192,57,43,.15); border-color: rgba(192,57,43,.3); color: #e07060; }
.dark-mode .det-remove-btn:hover { background: rgba(192,57,43,.25); }
.dark-mode .det-sparkline-msg,
.dark-mode .det-sparkline-pro-gate { color: #4a5570; }

/* ── Price mode toggle ───────────────────────────────────── */
.price-mode-switcher {
    display: flex;
    gap: 2px;
    background: #edf0f5;
    border-radius: 20px;
    padding: 3px;
    width: fit-content;
    margin: 0 0 12px 0;
}

.mode-btn {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #7a8499;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

.mode-btn.active {
    background: #fff;
    color: #1a2340;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ── Age stamp (shown inline after price in last_sale mode) ─ */
.sale-age-stamp {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #aab1c0;
    margin-left: 4px;
    vertical-align: middle;
    letter-spacing: .01em;
}

/* ── Detail modal: last sale condition table ─────────────── */
.det-last-sale-block {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f2f5;
}

.det-last-sale-title {
    font-size: 10px;
    font-weight: 700;
    color: #aab1c0;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}

.det-ls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}

.det-ls-row.det-ls-matched {
    background: #f4f7fb;
    border-radius: 6px;
    padding: 3px 6px;
    margin: 0 -6px;
}

.det-ls-cond {
    font-size: 12px;
    font-weight: 600;
    color: #7a8499;
    min-width: 54px;
}

.det-ls-price {
    font-size: 13px;
    font-weight: 700;
    color: #2c3a5a;
    flex: 1;
}

/* ── Dark mode: price mode toggle ───────────────────────── */
.dark-mode .price-mode-switcher { background: #1a1f35; }
.dark-mode .mode-btn { color: #4a5570; }
.dark-mode .mode-btn.active { background: #252840; color: #dce3f0; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.dark-mode .sale-age-stamp { color: #4a5570; }
.dark-mode .det-last-sale-block { border-top-color: rgba(255,255,255,.07); }
.dark-mode .det-last-sale-title { color: #4a5570; }
.dark-mode .det-ls-cond  { color: #4a5570; }
.dark-mode .det-ls-price { color: #9ab0d0; }
.dark-mode .det-ls-row.det-ls-matched { background: rgba(255,255,255,.04); }

/* ── Item status badges ──────────────────────────────────── */
.item-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 1px 6px;
    border-radius: 20px;
    vertical-align: middle;
}
.ist-on-hand  { background: #e8f5e9; color: #388e3c; }
.ist-grader   { background: #fff3e0; color: #e65100; }
.ist-for-sale { background: #e3f2fd; color: #1565c0; }
.ist-sold     { background: #ede7f6; color: #6a1b9a; }

/* ── Personal tag on row ─────────────────────────────────── */
.item-personal-tag {
    font-size: 10px;
    font-weight: 600;
    color: #9aa6bc;
    letter-spacing: .2px;
    margin-bottom: 1px;
}

/* ── Detail modal: personal tag ─────────────────────────── */
.det-personal-tag {
    font-size: 11px;
    font-weight: 600;
    color: #9aa6bc;
    margin-top: 2px;
    letter-spacing: .2px;
}

/* ── Detail modal: status row ───────────────────────────── */
.det-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid #f0f2f8;
    margin-top: 4px;
    gap: 8px;
}
.det-status-label {
    font-size: 12px;
    font-weight: 600;
    color: #7a8499;
    flex-shrink: 0;
}
.det-status-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.det-status-change-btn,
.det-sell-btn {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1.5px solid #d0d6e8;
    background: transparent;
    color: #4a5570;
    cursor: pointer;
    transition: all .15s;
}
.det-sell-btn { border-color: #e53935; color: #e53935; }
.det-sell-btn:hover { background: #e53935; color: #fff; }
.det-status-change-btn:hover { background: #f0f2f8; }
.det-sold-meta { font-size: 11px; color: #9aa6bc; }

/* ── Dark mode: status ───────────────────────────────────── */
.dark-mode .ist-on-hand  { background: rgba(56,142,60,.15);  color: #81c784; }
.dark-mode .ist-grader   { background: rgba(230,81,0,.15);   color: #ffb74d; }
.dark-mode .ist-for-sale { background: rgba(21,101,192,.15); color: #64b5f6; }
.dark-mode .ist-sold     { background: rgba(106,27,154,.15); color: #ce93d8; }
.dark-mode .item-personal-tag { color: #4a5570; }
.dark-mode .det-personal-tag  { color: #4a5570; }
.dark-mode .det-status-row    { border-top-color: rgba(255,255,255,.07); }
.dark-mode .det-status-label  { color: #4a5570; }
.dark-mode .det-status-change-btn { border-color: #2a3050; color: #9ab0d0; }
.dark-mode .det-status-change-btn:hover { background: #1a1f35; }

/* ── Modal centering fix ─────────────────────────────────── */
/* top/bottom/left/right must all be 0 so position:fixed fills
   the full viewport — Bootstrap's flex centering relies on
   height:100% which only computes if all four offsets are set.
   Without this, iOS Safari leaves the modal at the top.       */
body.tracker-app .modal {
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    -webkit-overflow-scrolling: touch;
}
body.tracker-app .modal-dialog {
    margin-left: auto !important;
    margin-right: auto !important;
}
body.tracker-app .modal-dialog-centered {
    min-height: calc(100% - 1rem);
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}
