:root {
    /* Surfaces, darkest first: page, sidebar/topbar, cards, raised controls */
    --bg-color: #0a0e13;
    --surface-1: #0e1319;
    --surface-2: #121820;
    --surface-3: #18202a;
    --glass-bg: #121820;
    --glass-border: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.12);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-dim: #6e7681;
    /* Brand: emerald */
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-soft: rgba(34, 197, 94, 0.12);
    --accent-line: rgba(34, 197, 94, 0.35);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #38bdf8;
    --card-bg: #121820;
    --radius: 14px;
    --sidebar-w: 248px;
    --topbar-h: 58px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* The old animated colour blobs are retired: flat surfaces read better. */
.blob-bg { display: none; }

/* Base UI Glass Container */
.glass-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Sections */
.section {
    display: none;
    padding: 34px 42px;
    animation: fadeIn 0.5s ease;
    flex: 1;
}
.section.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================= Login: brand panel + form ================= */
#loginSection {
    margin: auto;
    width: calc(100% - 32px);
    max-width: 920px;
    flex: 0 0 auto;
    padding: 0;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-radius: 22px;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--glass-border);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 44px 40px;
    background:
        radial-gradient(90% 70% at 20% 10%, rgba(168, 85, 247, 0.28), transparent 60%),
        radial-gradient(80% 60% at 90% 100%, rgba(34, 197, 94, 0.16), transparent 60%),
        #0c0a14;
    border-right: 1px solid var(--glass-border);
}

.login-brand .login-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(124, 58, 237, 0.35), 0 0 0 1px rgba(168, 85, 247, 0.25);
}

.login-brand h1 { margin-top: 8px; font-size: 2rem; font-weight: 900; font-style: italic; letter-spacing: 0.01em; }
.login-brand h1 span { color: #a855f7; }
.login-brand > p { color: var(--text-secondary); font-size: 0.95rem; }

.login-points { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.login-points li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.86rem;
    color: #c9d1d9;
    line-height: 1.45;
}

.login-points i {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    color: #4ade80;
    background: var(--accent-soft);
}

.login-form { display: flex; flex-direction: column; gap: 16px; padding: 44px 40px; }
.login-form-head h2 { font-size: 1.45rem; font-weight: 800; }
.login-form-head p { margin-top: 4px; color: var(--text-secondary); font-size: 0.86rem; }

.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field > span { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); }
.login-field input:not([type=checkbox]) { height: 46px; font-size: 0.95rem; }
.login-field .input-container input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]) { padding-right: 44px; }

.login-eye {
    position: absolute;
    right: 6px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}

.login-eye:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.input-container .login-eye i { position: static; left: auto; color: inherit; }

#loginBtn { width: 100%; height: 48px; margin-top: 4px; font-size: 0.98rem; }
.login-note { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 0.74rem; color: var(--text-dim); }

@media (max-width: 760px) {
    #loginSection { width: calc(100% - 24px); margin: auto; }
    .login-form-head { text-align: center; }
    .login-shell { grid-template-columns: minmax(0, 1fr); }
    .login-brand { padding: 26px 22px; border-right: 0; border-bottom: 1px solid var(--glass-border); align-items: center; text-align: center; }
    .login-brand .login-logo { width: 72px; height: 72px; border-radius: 18px; }
    .login-brand h1 { margin-top: 2px; font-size: 1.5rem; }
    .login-points { display: none; }
    .login-form { padding: 24px 20px 26px; }
}

.form-group { display: flex; flex-direction: column; gap: 15px; }

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}
.input-container i {
    position: absolute;
    left: 15px;
    color: var(--text-secondary);
}
/* Text fields. Checkboxes, radios and sliders keep the browser look. */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]) {
    width: 100%;
    padding: 11px 14px;
    background: rgba(1, 4, 9, 0.45);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.92rem;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
    background: rgba(1, 4, 9, 0.6);
}
/* only fields that carry a leading icon need the left inset */
.input-container input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]) { padding-left: 42px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
select { accent-color: var(--accent); }

.divider { display: flex; align-items: center; text-align: center; margin: 10px 0; color: var(--text-secondary); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--glass-border); }
.divider span { padding: 0 10px; }

.rescan-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    user-select: none;
}
.rescan-toggle--buy:hover {
    border-color: rgba(34,197,94,0.45);
    background: rgba(34,197,94,0.09);
}
.rescan-toggle--sell:hover {
    border-color: rgba(249,115,22,0.45);
    background: rgba(249,115,22,0.09);
}
.rescan-toggle__switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex: 0 0 40px;
}
.rescan-toggle__switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.rescan-toggle__slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.16);
    transition: 0.2s ease;
}
.rescan-toggle__slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #ffffff;
    transition: 0.2s ease;
}
.rescan-toggle__switch input:checked + .rescan-toggle__slider::before {
    transform: translateX(18px);
}
.rescan-toggle--buy .rescan-toggle__switch input:checked + .rescan-toggle__slider {
    background: rgba(34,197,94,0.95);
    border-color: rgba(34,197,94,0.95);
}
.rescan-toggle--sell .rescan-toggle__switch input:checked + .rescan-toggle__slider {
    background: rgba(249,115,22,0.95);
    border-color: rgba(249,115,22,0.95);
}
.rescan-toggle__text {
    font-size: 12px;
    line-height: 1.35;
}
.rescan-toggle--buy .rescan-toggle__text { color: #bbf7d0; }
.rescan-toggle--sell .rescan-toggle__text { color: #fed7aa; }

.btn {
    padding: 11px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s, filter 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.primary-btn { background: linear-gradient(180deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 6px 16px rgba(34, 197, 94, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.primary-btn:hover { filter: brightness(1.07); box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.small-btn { padding: 8px 14px; font-size: 0.85rem; background: rgba(255, 255, 255, 0.04); color: var(--text-primary); border: 1px solid var(--line-strong); }
.small-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }

/* ================= App shell: sidebar + topbar + content ================= */
#mainSection.section {
    padding: 0;
    flex-direction: row;
    align-items: stretch;
    min-height: 100vh;
}

/* sidebar */
.app-sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border-right: 1px solid var(--glass-border);
    z-index: 40;
}

.sb-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    height: var(--topbar-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.sb-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #04130a;
    background: linear-gradient(150deg, #4ade80, #16a34a);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.28);
}

.sb-mark { height: 30px; width: auto; flex-shrink: 0; border-radius: 6px; }
.sb-brand strong { display: block; font-size: 1.02rem; font-weight: 900; letter-spacing: 0.01em; font-style: italic; }
.sb-brand strong span { color: #a855f7; }
.sb-brand small { display: block; font-size: 0.7rem; color: var(--text-dim); margin-top: 1px; }

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group-label {
    padding: 14px 10px 6px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.nav-group-label:first-child { padding-top: 2px; }

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.nav-btn i { width: 18px; text-align: center; font-size: 0.95rem; opacity: 0.85; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }

.nav-btn.active {
    color: #4ade80;
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.18);
}

.nav-btn.active i { opacity: 1; }

.sb-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--glass-border);
}

.sb-clock {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 9px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
    color: #a5d6ff;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-help {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}

.sb-help:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.sb-backdrop { display: none; }

/* main column */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--topbar-h);
    padding: 0 28px;
    background: rgba(10, 14, 19, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.tb-menu { display: none; }
.tb-title { flex: 1; min-width: 0; font-size: 0.98rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; align-items: center; gap: 8px; }

.tb-icon,
.tb-menu {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: #f59e0b;
    cursor: pointer;
    place-items: center;
}

.tb-icon { display: grid; }
.tb-icon:hover, .tb-menu:hover { background: rgba(255, 255, 255, 0.07); }
.tb-menu { color: var(--text-primary); }

.tb-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.tb-logout:hover { background: rgba(239, 68, 68, 0.18); color: #fff; }

.dashboard-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 28px 40px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* account summary card */
.account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    border-radius: 16px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(34, 197, 94, 0.08), transparent 55%),
        var(--surface-2);
    border: 1px solid var(--glass-border);
}

.ac-who { display: flex; align-items: center; gap: 14px; min-width: 0; }

.ac-avatar {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: #4ade80;
    background: var(--accent-soft);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.ac-avatar.has-img { background: none; border-color: transparent; width: 52px; height: 52px; }
.ac-avatar.has-img img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45)); }
.ac-name { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ac-name strong { font-size: 1.08rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ac-vip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.ac-vip .vip-expiry { font-weight: 600; color: var(--text-secondary); }

.ac-stats { display: flex; align-items: stretch; }

.ac-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 0 22px;
    min-width: 0;
}

.ac-stat + .ac-stat { border-left: 1px solid var(--glass-border); }
.ac-stat small { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.ac-stat b { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-stat--bp b { color: #4ade80; }
.ac-stat--mc b { color: #fcd34d; }

/* panels */
.panels-container { min-width: 0; }
.panel { display: none; animation: fadeIn 0.25s ease; }
.panel.active { display: block; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.panel-header h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; }

/* ---------- player card (Chèn cầu thủ + search results) ---------- */
.player-card.pc { padding: 14px; display: flex; flex-direction: column; gap: 11px; }

.pc-head { display: flex; align-items: center; gap: 10px; min-width: 0; }

.pc-face {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--glass-border);
}

.pc-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.pc-face .face-fallback { position: absolute; inset: 0; align-items: center; justify-content: center; color: #555; font-size: 20px; }

.pc-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pc-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pc-name > span { flex: 0 1 auto; min-width: 0; font-size: 0.95rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-season { height: 16px; flex-shrink: 0; object-fit: contain; }

.pc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.7rem; color: var(--text-dim); }
.pc-ovr { padding: 1px 6px; border-radius: 5px; font-weight: 800; color: #93c5fd; background: rgba(59, 130, 246, 0.16); }
.pc-reset { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; font-weight: 700; color: #86efac; background: var(--accent-soft); }

.pc-fav {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 9px;
    display: grid;
    place-items: center;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pc-fav.is-on { color: #f87171; border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.08); }
.pc-fav:hover { color: #fff; background: rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.45); }

.pc-prices { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 5px; }

.pc-price {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(1, 4, 9, 0.35);
    border: 1px solid var(--glass-border);
}

.pc-price small { display: block; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.pc-price b { display: block; margin-top: 2px; font-size: 0.95rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-price--base b { font-size: 1.05rem; color: #fff; }
.pc-price--max b { color: #f87171; }
.pc-price--min b { color: #4ade80; }

.pc-tools { display: flex; align-items: center; gap: 4px; }
.pc-sold { flex: 1; min-width: 0; font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }
.pc-sold b { color: var(--text-primary); }
.pc-sold i { margin-right: 3px; }

.pc-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.pc-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }

.pc-trade { display: flex; gap: 6px; }

#favoritesTab .pc-trade-input,
.pc .pc-trade-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    text-align: center;
    font-weight: 800;
    font-size: 0.88rem;
    color: #e6edf3;
    font-variant-numeric: tabular-nums;
}

.pc-btn {
    height: 36px;
    min-width: 58px;
    padding: 0 13px;
    border: 0;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

.pc-btn:hover { filter: brightness(1.1); }
.pc-btn:active { transform: translateY(1px); }
.pc-btn--buy { background: #16a34a; }
.pc-btn--sell { background: #dc2626; }

.pc-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.pc-quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    background: transparent;
    transition: background 0.15s;
}

.pc-quick-btn b { font-variant-numeric: tabular-nums; }
.pc-quick-btn--buy { color: #86efac; border: 1px solid rgba(34, 197, 94, 0.35); }
.pc-quick-btn--buy:hover { background: rgba(34, 197, 94, 0.12); }
.pc-quick-btn--sell { color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.35); }
.pc-quick-btn--sell:hover { background: rgba(239, 68, 68, 0.12); }

.pc-autos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 11px; border-top: 1px solid var(--glass-border); }

.pc-auto {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 10px;
    border: 0;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

.pc-auto span { display: flex; flex-direction: column; line-height: 1.2; }
.pc-auto small { font-size: 0.64rem; font-weight: 600; opacity: 0.75; }
.pc-auto:hover { filter: brightness(1.08); }
.pc-auto:active { transform: translateY(1px); }
.pc-auto--buy { background: linear-gradient(180deg, #22c55e, #16a34a); box-shadow: 0 6px 16px rgba(34, 197, 94, 0.2); }
.pc-auto--sell { background: linear-gradient(180deg, #f97316, #ea580c); box-shadow: 0 6px 16px rgba(249, 115, 22, 0.2); }
.pc-auto.is-running { background: #991b1b; box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.5); animation: pulse 1.5s infinite; }

/* ---------- lineup on a pitch (tab Đội hình; same look as the GLXH lineup) ---------- */
.lu { margin-bottom: 26px; }
.lu-toolbar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.lu-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lu-field > span { font-size: 0.74rem; font-weight: 600; color: var(--text-secondary); }
.lu-grow { flex: 1 1 220px; max-width: 340px; }

.lu-seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--line-strong); }

.lu-seg button {
    position: relative;
    width: 44px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 800;
    cursor: pointer;
}

.lu-seg button:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.06); }
.lu-seg button.active { color: #0d1117; background: #f0f6fc; }
.lu-seg button:disabled { opacity: 0.35; cursor: not-allowed; }

.lu-cur { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25); }
.lu-seg .lu-cur { position: absolute; top: 4px; right: 5px; }

.lu-select {
    width: 100%;
    height: 38px;
    padding: 0 32px 0 12px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    color: var(--text-primary);
    font-size: 0.88rem;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(1, 4, 9, 0.45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b949e' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    cursor: pointer;
}

.lu-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }
.lu-select option { background: #161b22; }

.lu-meta { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.lu-meta > div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.lu-meta small { font-size: 0.66rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.lu-meta b { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.lu-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.lu-pitch { position: relative; width: 100%; aspect-ratio: 10 / 8.4; }

.lu-grass {
    position: absolute;
    inset: 0 0 3% 0;
    clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0 10%, transparent 10% 20%),
        linear-gradient(180deg, #3f8a2a, #4c9a33 55%, #57a83a);
}

.lu-pitch::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3%; background: #2d6a1f; border-radius: 0 0 6px 6px; }
.lu-grass i { position: absolute; display: block; border: 2px solid rgba(255, 255, 255, 0.55); }
.lu-grass .lu-mid { left: 0; right: 0; top: 42%; height: 0; border-width: 2px 0 0; }
.lu-grass .lu-circle { left: 50%; top: 42%; width: 17%; height: 15%; border-radius: 50%; transform: translate(-50%, -50%); }
.lu-grass .lu-box--top { top: -2px; height: 9%; left: 34%; right: 34%; border-top: 0; }
.lu-grass .lu-box--bot { bottom: -2px; height: 19%; left: 27%; right: 27%; border-bottom: 0; }
.lu-grass .lu-six--top { top: -2px; height: 4%; left: 42%; right: 42%; border-top: 0; }
.lu-grass .lu-six--bot { bottom: -2px; height: 8%; left: 38%; right: 38%; border-bottom: 0; }

.lu-players { position: absolute; inset: 0; }
.lu-pitch-empty { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.8); font-size: 0.85rem; }

.lu-pp {
    position: absolute;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transform: translate(-50%, -78%) scale(var(--s, 1));
    transform-origin: 50% 80%;
}

.lu-pp-face { position: relative; width: 52px; height: 52px; }

.lu-pp-img,
.lu-rr-face {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #e6edf3, #8b949e);
}

.lu-pp-img { width: 52px; height: 52px; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.85); }
.lu-pp-img img, .lu-rr-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.lu-pp-img .face-fallback, .lu-rr-face .face-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 900; color: #0d1117; }
.lu-pp-img .face-fallback { font-size: 0.9rem; }

.lu-pp-ovr { position: absolute; right: -24px; top: 10px; font-size: 1rem; font-weight: 900; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); font-variant-numeric: tabular-nums; }

.lu-pp-cap {
    position: absolute;
    left: -4px;
    top: -2px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    display: grid;
    place-items: center;
    font-size: 0.62rem;
    font-weight: 900;
    color: #fff;
    background: #1f2328;
    box-shadow: 0 0 0 1.5px #ffd76a;
}

.lu-pp-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 2px 6px 2px 3px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: rgba(1, 4, 9, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lu-pp-pos { flex-shrink: 0; font-style: normal; font-size: 0.56rem; font-weight: 900; padding: 1px 3px; border-radius: 3px; color: #fff; background: var(--pc, #484f58); }

.lu-pos--gk { --pc: #e3a008; }
.lu-pos--df { --pc: #2f81f7; }
.lu-pos--mf { --pc: #2ea043; }
.lu-pos--fw { --pc: #f85149; }

.lu-roster { border-radius: 14px; background: var(--surface-2); border: 1px solid var(--glass-border); overflow: hidden; }

.lu-roster-head,
.lu-rr {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 42px 30px;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.lu-roster-head { height: 34px; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); border-bottom: 1px solid var(--glass-border); }
.lu-roster-head span:nth-child(3) { text-align: right; }
.lu-rr { height: 42px; font-size: 0.82rem; }
.lu-rr + .lu-rr { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.lu-rr:hover { background: rgba(255, 255, 255, 0.03); }
.lu-rr-pos { font-size: 0.8rem; font-weight: 900; padding-left: 7px; border-left: 3px solid var(--pc, #484f58); line-height: 1.2; }
.lu-rr-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lu-rr-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lu-rr-face { width: 28px; height: 28px; flex-shrink: 0; }
.lu-rr-face .face-fallback { font-size: 0.6rem; }
.lu-rr-cap { flex-shrink: 0; font-style: normal; font-size: 0.6rem; font-weight: 900; padding: 1px 4px; border-radius: 4px; color: #ffd76a; box-shadow: inset 0 0 0 1px rgba(255, 215, 106, 0.6); }
.lu-rr-ovr { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.lu-grade { justify-self: end; width: 24px; height: 18px; border-radius: 3px; display: grid; place-items: center; font-size: 0.68rem; font-weight: 900; color: #fff; background: #484f58; }
.lu-grade--bronze { background: linear-gradient(180deg, #c98a5a, #8a5232); }
.lu-grade--silver { background: linear-gradient(180deg, #c9d1d9, #7d8590); color: #0d1117; }
.lu-grade--gold { background: linear-gradient(180deg, #ffd76a, #d29922); color: #3b2a00; }

.lu-roster-sub {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

.lu-muted { padding: 10px 12px; font-size: 0.78rem; color: var(--text-dim); }
.lu-note { margin: 12px 0 0; font-size: 0.72rem; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }

@media (max-width: 1100px) {
    .lu-body { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .lu-meta { margin-left: 0; width: 100%; justify-content: flex-start; }
    .lu-meta > div { align-items: flex-start; }
    .lu-grow { max-width: none; }
    .lu-pitch { aspect-ratio: 10 / 10; }
    .lu-pp { width: 64px; }
    .lu-pp-face, .lu-pp-img { width: 36px; height: 36px; }
    .lu-pp-ovr { right: -18px; top: 6px; font-size: 0.78rem; }
    .lu-pp-name { font-size: 0.58rem; }
    .lu-pp-pos { display: none; }
}

/* the search tab shows the same card: keep its size, and drop the outer box around it */
#searchResult > .player-card.pc { width: 100%; max-width: 380px; }
.search-result:has(> .player-card.pc) { background: none; border: 0; padding: 0; }

/* favourite groups A/B/C (the game's "Nhóm quan tâm") */
.fav-groups { display: flex; align-items: center; gap: 10px; min-width: 0; }

.fav-seg {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border-radius: 11px;
    background: var(--surface-1);
    border: 1px solid var(--line-strong);
    flex-shrink: 0;
}

.fav-seg button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    min-width: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.fav-seg button small {
    font-size: 0.66rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-dim);
}

.fav-seg button:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.fav-seg button.active { background: #f0f6fc; color: #0d1117; }
.fav-seg button.active small { background: rgba(13, 17, 23, 0.12); color: #0d1117; }

.fav-group-name {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding: 0 14px;
    min-width: 0;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--glass-border);
    font-weight: 800;
    font-size: 0.95rem;
}

.fav-group-name i { color: #f87171; font-size: 0.85rem; }
.fav-group-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 760px) {
    .fav-header { flex-direction: column; align-items: stretch; }
    .fav-groups { width: 100%; flex-wrap: wrap; }
    .fav-seg { width: 100%; }
    .fav-seg button { flex: 1; justify-content: center; }
    .fav-group-name { flex: 1 1 100%; }
}

/* shell on tablets / phones: the sidebar becomes a drawer */
@media (max-width: 1024px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    body.sb-open .app-sidebar { transform: none; }

    .sb-backdrop {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(0, 0, 0, 0.55);
    }

    body.sb-open .sb-backdrop { display: block; }
    .tb-menu { display: grid; }
    .topbar { padding: 0 16px; }
    .dashboard-content { padding: 18px 16px 32px; gap: 16px; }
}

@media (max-width: 760px) {
    .account-card { flex-direction: column; align-items: stretch; padding: 16px; gap: 14px; }
    .ac-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .ac-stat { padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--glass-border); }
    .ac-stat + .ac-stat { border-left: 1px solid var(--glass-border); }
    .ac-stat b { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; }
    .ac-stat small { font-size: 0.6rem; letter-spacing: 0.04em; }
    .tb-logout span { display: none; }
    .tb-logout { width: 36px; padding: 0; justify-content: center; }
}
.favorites-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.favorites-search-wrap {
    position: relative;
    width: min(360px, 45vw);
}
.favorites-search-wrap i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 12px;
    pointer-events: none;
}
#favoritesSearchInput {
    width: 100%;
    padding: 10px 12px 10px 34px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.3);
    color: var(--text-primary);
    font-size: 0.9rem;
}
#favoritesSearchInput:focus {
    outline: none;
    border-color: var(--accent);
}

/* Cards Grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 14px; }
.player-card {
    background: var(--surface-2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}
.player-card:hover { border-color: var(--accent-line); box-shadow: 0 12px 28px rgba(0,0,0,0.35); }
.player-card .grade { position: absolute; top: 15px; right: 15px; background: rgba(255,255,255,0.1); padding: 5px 10px; border-radius: 8px; font-weight: 800; font-size: 1rem; color: #ffd700; }
.player-card h3 { margin-bottom: 5px; color: var(--text-primary); font-size: 1.2rem; }
.player-card .spid { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 15px; }
.player-card .price-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 1.05rem; }
.player-card .price-row .val { font-weight: 600; color: white; }

.inventory-section {
    margin-bottom: 16px;
}
.inventory-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    font-size: 13px;
    font-weight: 800;
}
.inventory-section-count {
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    background: rgba(255,255,255,0.08);
}
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 10px;
}
.inventory-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.045);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.inventory-card:hover {
    border-color: rgba(34, 197, 94,0.28);
    background: rgba(255,255,255,0.065);
    transform: translateY(-1px);
}
.inventory-season {
    width: 28px;
    min-width: 28px;
    display: flex;
    justify-content: center;
}
.inventory-season img {
    max-width: 28px;
    max-height: 24px;
    object-fit: contain;
}
.inventory-name {
    font-weight: 800;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inventory-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    color: #8b949e;
    font-size: 11px;
}
.inventory-pill {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
}
.inventory-grade {
    min-width: 34px;
    text-align: right;
    font-weight: 900;
    font-size: 15px;
}
.grade-icon {
    width: 27px;
    height: 16px;
    object-fit: contain;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: middle;
}
.grade-icon--sm {
    width: 27px;
    height: 16px;
}
.grade-icon--lg {
    width: 27px;
    height: 16px;
}
.inventory-grade .grade-icon {
    width: 27px;
    height: 16px;
}
.inventory-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.inventory-action-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s ease;
}
.inventory-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}
.inventory-action-btn.registry {
    background: rgba(46,160,67,0.12);
    border: 1px solid rgba(46,160,67,0.28);
    color: #7ee787;
}
.inventory-action-btn.registry:hover:not(:disabled) {
    background: rgba(46,160,67,0.2);
}
.inventory-action-btn.favorite {
    background: rgba(218,54,51,0.08);
    border: 1px solid rgba(218,54,51,0.18);
    color: var(--danger);
}
.inventory-action-btn.favorite:hover {
    background: rgba(218,54,51,0.18);
}

/* ─── Inventory table layout (Đội hình / Kho) ─── */
.inv-section {
    margin-bottom: 26px;
}
.inv-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.inv-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}
.inv-section-title.is-squad .inv-section-value { color: #4ade80; }
.inv-section-title.is-reserve .inv-section-value { color: #4ade80; }
.inv-section-value {
    font-weight: 800;
}
.inv-section-count {
    font-size: 12px;
    font-weight: 700;
    color: #8b949e;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
}
.inv-batch-btn {
    white-space: nowrap;
}
.inv-batch-btn.active {
    background: rgba(218,54,51,0.18);
    border-color: rgba(218,54,51,0.4);
    color: #ff7b72;
}
.inv-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
}
.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.inv-table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #8b949e;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
    background: rgba(255,255,255,0.015);
}
.inv-table tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle;
}
.inv-table tbody tr:last-child td {
    border-bottom: none;
}
.inv-row {
    transition: background 0.15s ease;
}
.inv-row:hover {
    background: rgba(255,255,255,0.035);
}
.inv-col-select {
    width: 40px;
    text-align: center;
}
.inv-col-grade,
.inv-col-ovr {
    white-space: nowrap;
}
/* Cột giá trong bảng tra cứu — giống cột "Giá cầu thủ" của màn hình chợ trong game */
.inv-col-price {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.inv-price {
    font-weight: 700;
    color: #f0b429;
}
.inv-price.is-unknown {
    color: #6e7681;
    font-weight: 500;
}
/* ── Tra cứu: bảng gọn + panel chi tiết (bố cục giống màn hình chợ trong game) ── */
.lk-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 14px;
    align-items: start;
    margin-top: 4px;
}
@media (max-width: 1180px) {
    .lk-wrap { grid-template-columns: minmax(0, 1fr); }
    .lk-right { position: static; }
}
.lk-left { min-width: 0; }

.lk-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.lk-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 12px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #7d8590;
    background: rgba(13, 17, 23, 0.96);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}
.lk-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    vertical-align: middle;
}
.lk-table tbody tr:last-child td { border-bottom: none; }
.lk-col-pos { width: 64px; }
.lk-col-grade { width: 74px; }
.lk-col-ovr { width: 62px; text-align: right; }
.lk-col-price { width: 126px; text-align: right; }
.lk-col-name { min-width: 190px; }

.lk-row { cursor: pointer; transition: background 0.12s ease; }
.lk-row:hover { background: rgba(34, 197, 94, 0.06); }
.lk-row.is-active {
    background: linear-gradient(90deg, rgba(240, 180, 41, 0.16), rgba(240, 180, 41, 0.02));
    box-shadow: inset 3px 0 0 #f0b429;
}
.lk-row.is-active .lk-name { color: #fff; }

.lk-name {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    font-size: 13px;
    color: #e6edf3;
    line-height: 1.2;
}
.lk-season-img { width: 19px; height: 19px; object-fit: contain; flex-shrink: 0; }
.lk-meta { display: none; }
.lk-season {
    margin-left: 6px;
    font-size: 10.5px;
    font-weight: 700;
    color: #7d8590;
    letter-spacing: 0.3px;
}
.lk-ovr { font-weight: 700; color: #e6edf3; font-variant-numeric: tabular-nums; }
.lk-price {
    font-weight: 800;
    color: #f0b429;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.lk-price.is-unknown { color: #6e7681; font-weight: 500; }

/* Panel phải */
.lk-right { position: sticky; top: 12px; }
.lk-hint {
    padding: 26px 16px;
    text-align: center;
    color: #7d8590;
    font-size: 12.5px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: var(--glass-bg);
}
.lk-card {
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    padding: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.lk-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.lk-card-season { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.lk-card-id { min-width: 0; flex: 1; }
.lk-card-name {
    font-size: 15.5px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lk-card-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    color: #7d8590;
    flex-wrap: wrap;
}
.lk-card-season-txt {
    font-weight: 800;
    color: #c9d1d9;
    font-size: 10.5px;
    letter-spacing: 0.4px;
}
.lk-card-reset { color: #a78bfa; font-size: 10.5px; }

/* Bảng 13 cấp */
/* Danh sách mobile dạng thẻ (div, không phải table) */
.lk-list { display: flex; flex-direction: column; }
.lk-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    min-height: 56px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
}
.lk-item:active { background: rgba(34, 197, 94, 0.1); }
.lk-item.is-active {
    background: linear-gradient(90deg, rgba(240, 180, 41, 0.14), transparent);
    box-shadow: inset 3px 0 0 #f0b429;
}
.lk-item-pos { flex: 0 0 auto; }
.lk-item-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}
.lk-item-main .lk-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
}
.lk-item-main .lk-season { flex: 0 0 auto; font-size: 10px; }
.lk-item-meta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.lk-item-meta .grade-icon { width: 17px; height: 17px; font-size: 8.5px; }
.lk-item-meta em {
    font-style: normal;
    font-size: 10.5px;
    font-weight: 700;
    color: #8b949e;
}
.lk-item-price { flex: 0 0 auto; text-align: right; font-size: 15px; }

.lk-gtable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 9px;
    font-size: 12.5px;
}
.lk-gtable thead th {
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #7d8590;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}
.lk-gtable tbody td {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-variant-numeric: tabular-nums;
}
.lk-gtable tbody tr:last-child td { border-bottom: none; }
.lk-grow { cursor: pointer; transition: background 0.12s ease; }
.lk-grow:hover { background: rgba(255, 255, 255, 0.05); }
.lk-grow.is-cur {
    background: rgba(240, 180, 41, 0.13);
    box-shadow: inset 3px 0 0 #f0b429;
}
.lk-grow.is-cur .lk-gcol-ovr { color: #fff; }
.lk-gcol-grade { width: 82px; }
.lk-gcol-ovr { width: 44px; text-align: right; color: #c9d1d9; font-weight: 700; }
.lk-gcol-price { text-align: right; font-weight: 800; color: #f0b429; }
.lk-gcol-lim { text-align: right; color: #7d8590; }

/* Sổ lệnh */
.lk-book-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 13px;
    padding-top: 11px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #7d8590;
}
.lk-book-tools {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.lk-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.2px;
    text-transform: none;
    cursor: pointer;
    white-space: nowrap;
}
.lk-tool-btn:hover { background: rgba(34, 197, 94, 0.22); color: #cae8ff; }
.lk-book-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8b949e;
    border-radius: 6px;
    width: 24px;
    height: 22px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s;
}
.lk-book-refresh:hover { color: #fff; border-color: rgba(255, 255, 255, 0.28); }
.lk-book {
    display: flex;
    gap: 8px;
    margin-top: 7px;
    max-height: 210px;
}
.lk-ob-side {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 9px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.22);
}
.lk-ob-title {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    position: sticky;
    top: 0;
    background: rgba(13, 17, 23, 0.97);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.lk-ob-title.sell { color: #38bdf8; }
.lk-ob-title.buy { color: #f87171; }
.lk-ob-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.09);
    color: #c9d1d9;
    border-radius: 999px;
    padding: 0 6px;
    font-size: 9.5px;
    font-weight: 700;
}
.lk-ob-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    padding: 3.5px 8px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid rgba(255, 255, 255, 0.028);
}
.lk-ob-row:last-child { border-bottom: none; }
.lk-ob-row:hover { background: rgba(255, 255, 255, 0.04); }
.lk-ob-price { font-weight: 700; }
.lk-ob-price.sell { color: #7dd3fc; }
.lk-ob-price.buy { color: #fca5a5; }
.lk-ob-count { font-weight: 800; font-size: 11.5px; }
.lk-ob-count.sell { color: #38bdf8; }
.lk-ob-count.buy { color: #f87171; }
.lk-ob-empty,
.lk-book-loading {
    padding: 15px 8px;
    text-align: center;
    color: #6e7681;
    font-size: 11.5px;
    width: 100%;
}

@media (min-width: 769px) {
    .lk-list { display: none; }
}
/* ── Mobile (<=768px): danh sách thành thẻ 1 dòng, panel full width ── */
@media (max-width: 768px) {
    .lk-wrap { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .lk-right { position: static; }
    .lk-hint { padding: 20px 12px; }

    /* Danh sách: mỗi dòng là 1 thẻ flex (vị trí | tên (+cấp, OVR) | giá) */
    .lk-left .inv-table-wrap { border: none; background: none; overflow: visible; }
    .lk-table, .lk-table tbody { display: block; width: 100%; }
    .lk-table thead { display: none; }
    .lk-table tbody tr.lk-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 11px 12px;
        min-height: 56px;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        background: transparent;
        border-radius: 0;
        box-sizing: border-box;
    }
    .lk-table tbody tr.lk-row:active { background: rgba(34, 197, 94, 0.1); }
    .lk-table tbody tr.lk-row.is-active {
        background: linear-gradient(90deg, rgba(240, 180, 41, 0.14), transparent);
        box-shadow: inset 3px 0 0 #f0b429;
    }
    .lk-table tbody tr.lk-row td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        width: auto !important;
        white-space: nowrap;
        text-align: left !important;
    }
    /* Hai cột này đã gộp vào .lk-meta trên mobile. Phải cùng/hơn specificity với
       luật '.lk-table tbody tr.lk-row td' ở trên, nếu không nó vẫn thắng. */
    .lk-table tbody tr.lk-row td.lk-col-grade,
    .lk-table tbody tr.lk-row td.lk-col-ovr { display: none !important; }

    .lk-row .lk-col-pos { flex: 0 0 auto; }
    .lk-row .lk-col-name {
        flex: 1 1 auto;
        min-width: 0 !important;
        max-width: none !important;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex !important;
        align-items: center;
        gap: 5px;
        flex-wrap: nowrap;
    }
    .lk-row .lk-col-price { flex: 0 0 auto; margin-left: auto; text-align: right !important; }

    .lk-row .lk-name {
        font-size: 13.5px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .lk-row .lk-season { margin-left: 0; font-size: 10px; flex: 0 0 auto; }
    .lk-row .lk-meta {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        margin-left: auto;
        padding-left: 6px;
        flex: 0 0 auto;
    }
    .lk-row .lk-meta .grade-icon { width: 17px; height: 17px; font-size: 8.5px; }
    .lk-meta-ovr {
        font-style: normal;
        font-size: 10px;
        font-weight: 700;
        color: #8b949e;
        letter-spacing: 0.2px;
    }
    .lk-row .lk-price { font-size: 15px; font-weight: 800; }

    /* Bảng 13 cấp: PHẢI giữ là bảng (5 cột hẹp) — luật .inv-table bên dưới sẽ
       biến td thành block nếu không ép. */
    .lk-gtable { display: table !important; width: 100% !important; border-collapse: collapse !important; }
    .lk-gtable thead { display: table-header-group !important; }
    .lk-gtable tbody { display: table-row-group !important; }
    .lk-gtable tr { display: table-row !important; }
    .lk-gtable th,
    .lk-gtable td {
        display: table-cell !important;
        width: auto !important;
        padding: 5px 4px !important;
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
        text-align: right !important;
        white-space: nowrap !important;
        font-size: 12px;
    }
    .lk-gtable th { font-size: 9.5px; color: #7d8590; }
    .lk-gtable th:first-child,
    .lk-gtable td:first-child { text-align: left !important; }
    .lk-gcol-grade { width: 54px !important; }
    .lk-gcol-ovr { width: 32px !important; }

    /* Panel */
    .lk-card { padding: 11px; border-radius: 12px; }
    .lk-card-name { font-size: 14.5px; }
    .lk-book { max-height: 200px; }
    .lk-actions .btn { padding: 12px 8px; font-size: 13px; min-height: 44px; }

    /* Ô tìm kiếm cho dễ chạm */
    #marketTab .search-box { flex-wrap: wrap; gap: 8px !important; }
    #marketTab .search-box > input { flex: 1 1 100% !important; min-height: 44px; }
    #marketTab .search-box > button { flex: 1 1 100%; min-height: 44px; }
}

/* Nút hành động */
.lk-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.lk-actions .btn {
    flex: 1;
    justify-content: center;
    white-space: nowrap;
    padding: 9px 8px;
    font-size: 12.5px;
    font-weight: 800;
    border-radius: 9px;
}
/* Cùng màu với nút Auto Snipe / Auto Sell trong thẻ cầu thủ (favorites.js) */
.lk-buy {
    background: var(--success, #2ea043);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(46, 160, 67, 0.26);
}
.lk-buy:hover { filter: brightness(1.1); }
.lk-sell {
    background: var(--danger, #da3633);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(218, 54, 51, 0.24);
}
.lk-sell:hover { filter: brightness(1.1); }

.inv-col-value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.inv-col-action {
    width: 1%;
    white-space: nowrap;
}
.inv-batch-check {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--danger);
}
.inv-player-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 180px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.inv-player-cell:hover {
    background: rgba(34, 197, 94,0.08);
}
.inv-player-cell:hover .inv-player-name {
    color: #86efac;
}
.inv-face-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.inv-face {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255,255,255,0.05);
}
.inv-face-fallback {
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    color: #555;
    font-size: 18px;
}
.inv-player-info {
    min-width: 0;
}
.inv-player-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.inv-player-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}
.inv-season-img {
    max-width: 22px;
    max-height: 18px;
    object-fit: contain;
}
.inv-pos-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}
.inv-reset {
    font-size: 10px;
    color: #8b949e;
}
.inv-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}
.inv-act-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #c9d1d9;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.inv-act-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.09);
}
.inv-act-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.inv-act-btn.act-replace {
    border-color: rgba(34, 197, 94,0.3);
    color: #86efac;
    background: rgba(34, 197, 94,0.08);
}
.inv-act-btn.act-replace:hover:not(:disabled) { background: rgba(34, 197, 94,0.16); }
.inv-act-btn.act-add {
    border-color: rgba(46,160,67,0.3);
    color: #7ee787;
    background: rgba(46,160,67,0.08);
}
.inv-act-btn.act-add:hover:not(:disabled) { background: rgba(46,160,67,0.16); }
.inv-act-btn.act-buy {
    border-color: rgba(218,54,51,0.3);
    color: #ff7b72;
    background: rgba(218,54,51,0.08);
}
.inv-act-btn.act-buy:hover:not(:disabled) { background: rgba(218,54,51,0.16); }
.inv-act-btn.act-sell {
    border-color: rgba(46,160,67,0.3);
    color: #7ee787;
    background: rgba(46,160,67,0.08);
}
.inv-act-btn.act-sell:hover:not(:disabled) { background: rgba(46,160,67,0.16); }
.inv-act-btn.act-upgrade {
    border-color: rgba(34, 197, 94,0.3);
    color: #86efac;
    background: rgba(34, 197, 94,0.08);
}
.inv-act-btn.act-upgrade:hover:not(:disabled) { background: rgba(34, 197, 94,0.16); }

/* Batch-sell floating bar */
.inv-batch-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    background: #161b22;
    border: 1px solid rgba(240,246,252,0.14);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.inv-batch-bar-info {
    font-size: 13px;
    color: #c9d1d9;
}
.inv-batch-confirm {
    background: var(--danger) !important;
    color: #fff !important;
    border-color: var(--danger) !important;
}
.inv-batch-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.inv-bsell-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.inv-bsell-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inv-bsell-price {
    width: 130px;
    font-size: 13px;
    padding: 7px 8px;
    text-align: right;
    font-weight: 700;
    color: var(--accent);
    background: rgba(13,17,23,0.7);
    border: 1px solid rgba(240,246,252,0.14);
    border-radius: 8px;
}

.vip-expiry {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Kho vật phẩm (items inventory) ── */
.items-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.items-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 3px;
}
.items-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: 0.2s ease;
}
.items-toggle-btn:hover { color: var(--text-primary); }
.items-toggle-btn.active {
    background: linear-gradient(145deg, #4ade80, #16a34a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(60,145,240,0.32);
}
.items-search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}
.items-search-wrap i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 12px;
    pointer-events: none;
}
#itemsSearchInput {
    width: 100%;
    padding: 10px 12px 10px 34px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.3);
    color: var(--text-primary);
    font-size: 0.9rem;
}
#itemsSearchInput:focus { outline: none; border-color: var(--accent); }
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
    gap: 12px;
}
.item-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.04);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.item-card:hover {
    border-color: rgba(34, 197, 94,0.28);
    background: rgba(255,255,255,0.06);
    transform: translateY(-1px);
}
.item-top {
    display: flex;
    align-items: center;
    gap: 14px;
}
.item-icon {
    width: 64px;
    height: 64px;
    min-width: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.35);
    overflow: hidden;
}
.item-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.item-icon-fallback {
    color: #f2cc60;
    font-size: 26px;
}
.item-body { flex: 1; min-width: 0; }
.item-name {
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.item-meta {
    font-size: 12px;
    color: #8b949e;
    line-height: 1.5;
}
.item-claim-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(34, 197, 94,0.35);
    border-radius: 9px;
    cursor: pointer;
    background: rgba(34, 197, 94,0.14);
    color: #8cc4ff;
    transition: 0.2s ease;
}
.item-claim-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94,0.24);
    border-color: rgba(34, 197, 94,0.5);
}
.item-claim-btn:disabled { cursor: not-allowed; opacity: 0.65; }
.item-store-tag {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #8b949e;
}
.item-open-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(34, 197, 94,0.35);
    border-radius: 9px;
    cursor: pointer;
    background: rgba(34, 197, 94,0.14);
    color: #8cc4ff;
    transition: 0.2s ease;
}
.item-open-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94,0.24);
    border-color: rgba(34, 197, 94,0.5);
}
.item-open-btn:disabled { cursor: not-allowed; opacity: 0.65; }

/* ===== Mở hàng loạt (batch select) ===== */
#itemsBatchToggleBtn.active {
    background: rgba(248,81,73,0.16);
    border-color: rgba(248,81,73,0.5);
    color: #ff7b72;
}
.item-card.selectable { cursor: pointer; }
.item-card.selectable:hover {
    border-color: rgba(34, 197, 94,0.4);
}
.item-select {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    cursor: pointer;
}
.item-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}
.items-batch-bar {
    position: sticky;
    bottom: 14px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94,0.3);
    background: rgba(20,24,33,0.96);
    box-shadow: 0 8px 26px rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    z-index: 20;
}
.items-batch-bar.hidden { display: none; }
.items-batch-info { color: #c9d1d9; font-size: 14px; }
.items-batch-info b { color: var(--accent); font-size: 15px; }
.items-batch-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Modal Mở vật phẩm ===== */
.open-modal-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #8b949e;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s ease;
}
.open-modal-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.open-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 16px;
}
.open-item-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.open-item-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
}
.open-item-icon .item-icon { width: 56px; height: 56px; min-width: 56px; }
.open-item-name { font-weight: 800; font-size: 15px; color: #fff; }
.open-item-sub { font-size: 12px; color: #8b949e; margin-top: 3px; }
.open-item-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.open-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 70px;
    padding: 8px 12px;
    border-radius: 9px;
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.07);
}
.open-stat-label { font-size: 11px; color: #8b949e; }
.open-stat-value { font-size: 16px; font-weight: 800; color: #fff; }
.open-results-title {
    font-size: 12px;
    font-weight: 700;
    color: #8b949e;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.open-results-head {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #6e7681;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.open-results-body {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 18px;
}
.open-result-empty {
    text-align: center;
    padding: 30px 20px;
    color: #6e7681;
    font-size: 13px;
}
.open-result-row {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
}
.open-result-type { flex: 0 0 90px; color: #8b949e; display: inline-flex; align-items: center; gap: 6px; }
.open-result-item { flex: 1; color: #fff; display: inline-flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
.open-result-value { flex: 0 0 110px; text-align: right; font-weight: 700; color: #2ea043; }
.open-result-season {
    font-size: 11px;
    color: #8b949e;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
}
.open-result-season-img {
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}
.open-result-ovr {
    font-size: 11px;
    font-weight: 700;
    color: #f0b429;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(240,180,41,0.12);
}
.open-item-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.open-count-wrap { display: flex; flex-direction: column; gap: 6px; }
.open-count-wrap label { font-size: 12px; font-weight: 600; color: #8b949e; }
.open-count-input {
    width: 100px;
    padding: 9px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94,0.3);
    font-size: 14px;
}
.open-confirm-btn {
    background: #15803d;
    border: none;
    box-shadow: 0 5px 15px rgba(22, 163, 74,0.4);
}
.open-all-btn {
    background: rgba(34, 197, 94,0.14);
    border: 1px solid rgba(34, 197, 94,0.35);
    color: #8cc4ff;
}
.open-all-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94,0.24);
    border-color: rgba(34, 197, 94,0.5);
}
.open-all-btn:disabled { cursor: not-allowed; opacity: 0.65; }
.items-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #8b949e;
    font-size: 14px;
}

.upgrade-maintenance {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 620px;
    margin: 0 auto;
    padding: 34px;
    border-radius: 12px;
    border: 1px solid rgba(240,246,252,0.1);
    background: linear-gradient(145deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018));
}
.upgrade-maintenance__eyebrow {
    width: fit-content;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(242,204,96,0.32);
    background: rgba(187,128,9,0.1);
    color: #f2cc60;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.upgrade-maintenance h3 {
    color: #f0f6fc;
    font-size: 1.35rem;
    margin-bottom: 10px;
}
.upgrade-maintenance p {
    color: #9da7b3;
    line-height: 1.65;
    max-width: 520px;
}
.upgrade-maintenance__bar {
    height: 6px;
    margin-top: 22px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
}
.upgrade-maintenance__bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f2cc60, #4ade80);
}

/* Skeletons */
.skeleton-card { background: var(--card-bg); height: 160px; border-radius: 15px; position: relative; overflow: hidden; }
.skeleton-card::after { content: ""; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent); animation: skeleton 1.5s infinite; }
@keyframes skeleton { 100% { left: 100%; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Utils */
.hidden { display: none !important; }
.toast { position: fixed; bottom: 24px; right: 24px; max-width: min(420px, calc(100vw - 32px)); background: var(--surface-3); color: var(--text-primary); padding: 13px 18px 13px 16px; border-radius: 12px; border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); box-shadow: 0 16px 40px rgba(0,0,0,0.55); font-size: 0.9rem; font-weight: 600; transform: translateY(24px); opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease; z-index: 10000; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--danger); }

.search-result { margin-top: 20px; background: var(--card-bg); padding: 20px; border-radius: 15px; border: 1px solid var(--glass-border); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; opacity: 0; pointer-events: none; transition: 0.3s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-box {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    padding: 26px;
    width: 90%; max-width: 400px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    text-align: center;
    transform: translateY(-20px) scale(0.95); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-box h3 { margin-bottom: 10px; color: white; font-size: 1.2rem; font-weight: 800; }
.modal-box p { margin-bottom: 22px; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.55; }
.modal-actions { display: flex; gap: 15px; justify-content: center; }

/* Order Book Table */
.ob-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.95rem; }
.ob-table th, .ob-table td { padding: 10px; text-align: center; border-bottom: 1px solid var(--glass-border); }
.ob-table th { color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--glass-border); }
.ob-buy { color: var(--danger); font-weight: 700; }
.ob-sell { color: var(--accent); font-weight: 700; }
.ob-price { color: white; font-weight: 600; }

/* Autocomplete CSS Override */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: calc(100% - 190px);
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
}
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}
.autocomplete-item:hover {
    background: rgba(255,255,255,0.1);
}
.autocomplete-item:last-child {
    border-bottom: none;
}

/* Price-history snapshot dropdown (custom, themed) */
.ph-select { position: relative; user-select: none; }
.ph-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.ph-select__trigger:hover { border-color: var(--accent); }
.ph-select.open .ph-select__trigger { border-color: var(--accent); background: rgba(34, 197, 94,0.08); }
.ph-select__caret { color: var(--text-secondary); font-size: 11px; transition: transform 0.2s; flex-shrink: 0; }
.ph-select.open .ph-select__caret { transform: rotate(180deg); }
.ph-select__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(18, 18, 18, 0.97);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    z-index: 1200;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 12px 30px rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    padding: 4px;
    display: none;
}
.ph-select.open .ph-select__menu { display: block; }
.ph-select__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.15s;
}
.ph-select__option:hover { background: rgba(255,255,255,0.07); }
.ph-select__option.selected { background: var(--accent); color: #fff; font-weight: 700; }
.ph-select__option .ph-opt-ago { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-select__option .ph-opt-meta { color: var(--text-secondary); font-size: 12px; flex-shrink: 0; }
.ph-select__option.selected .ph-opt-meta { color: rgba(255,255,255,0.85); }

/* Phân bổ cấp thẻ 24h */
.ph-dist {
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: rgba(255,255,255,0.025);
    overflow: hidden;
}
.ph-dist-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-align: left;
}
.ph-dist-toggle .ph-dist-caret {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}
.ph-dist.collapsed .ph-dist-caret {
    transform: rotate(-90deg);
}
.ph-dist-body {
    padding: 0 14px 12px;
}
.ph-dist.collapsed .ph-dist-body {
    display: none;
}
.ph-dist-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.ph-dist-title {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ph-dist-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.ph-dist-totals {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.ph-dist-totals b { color: #fff; font-weight: 800; }
.ph-dist-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ph-dist-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
}
.ph-dist-chip b { color: #fff; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Settings columns */
.settings-columns {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.settings-columns > div {
    flex: 1;
    min-width: 0;
}

/* ============= MOBILE RESPONSIVE ============= */
@media (max-width: 768px) {
    .section {
        padding: 15px;
    }


    .panel-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        margin-bottom: 15px;
    }
    .panel-header h2 { font-size: 1rem; flex:1; }
    .favorites-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .favorites-search-wrap {
        width: 100%;
        min-width: 0;
    }

    /* Cards */
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .player-card {
        padding: 14px;
    }
    .player-card h3 {
        font-size: 0.95rem;
        padding-right: 35px !important;
    }
    .player-card .grade {
        top: 10px;
        right: 10px;
        padding: 3px 8px;
        font-size: 0.85rem;
    }
    .player-card .price-row {
        font-size: 0.9rem;
    }

    /* Modals */
    .modal-box {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-box h3 { font-size: 1.2rem; }

    /* Toast */
    .toast {
        left: 10px;
        right: 10px;
        bottom: 15px;
        font-size: 0.85rem;
        padding: 12px 15px;
    }

    /* Autocomplete */
    .autocomplete-dropdown {
        width: 100%;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* Settings: 1 cột trên mobile */
    .settings-columns {
        flex-direction: column;
        gap: 16px;
    }

    /* Inventory: bảng → thẻ dọc, không cần cuộn ngang */
    .inv-table-wrap {
        overflow-x: visible;
        border: none;
        border-radius: 0;
        background: none;
    }
    .inv-table,
    .inv-table tbody,
    .inv-table tbody tr,
    .inv-table tbody td {
        display: block;
        width: 100%;
    }
    .inv-table thead {
        display: none;
    }
    .inv-row {
        border: 1px solid rgba(255,255,255,0.09);
        border-radius: 12px;
        background: rgba(255,255,255,0.03);
        padding: 12px;
        margin-bottom: 12px;
    }
    .inv-row:hover {
        background: rgba(255,255,255,0.03);
    }
    .inv-table tbody td {
        padding: 0;
        border-bottom: none;
    }
    /* Ô cầu thủ full-width ở trên cùng */
    .inv-col-player {
        margin-bottom: 10px;
    }
    .inv-player-cell {
        min-width: 0;
    }
    .inv-player-name {
        max-width: none;
    }
    /* Cấp thẻ / OVR / Giá trị: hàng nhãn - giá trị */
    .inv-col-grade,
    .inv-col-ovr,
    .inv-col-value {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 6px 2px !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        font-size: 0.82rem;
    }
    .inv-col-grade::before,
    .inv-col-ovr::before,
    .inv-col-value::before {
        content: attr(data-label);
        color: #8b949e;
        font-weight: 600;
        font-size: 0.78rem;
    }
    /* Nút hành động dàn đủ chiều ngang */
    .inv-col-action {
        width: 100% !important;
        margin-top: 10px;
    }
    .inv-actions {
        justify-content: stretch;
        flex-wrap: wrap;
        gap: 8px;
    }
    .inv-act-btn {
        flex: 1 1 0;
        justify-content: center;
        padding: 10px 8px;
        font-size: 0.8rem;
    }
    /* Checkbox chọn (batch) hiển thị đầu thẻ khi bật */
    .inv-col-select {
        width: 100% !important;
        text-align: left !important;
        margin-bottom: 8px;
    }
    /* Header section: gọn lại trên mobile */
    .inv-section-head {
        flex-wrap: wrap;
    }
    .inv-section-title {
        font-size: 0.95rem;
    }
}

@media (min-width: 1600px) {
    .section {
        padding: 38px 46px;
    }
}

@media (max-width: 400px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .player-card {
        padding: 12px;
    }
}

/* ─── Snipe Targets Panel (two-column layout) ─── */
.snipe-panel-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: #8b949e;
}
.snipe-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
    align-items: start;
}
@media (max-width: 900px) {
    .snipe-layout {
        grid-template-columns: 1fr;
    }
}
.snipe-tasks-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
}
.snipe-tasks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.snipe-tasks-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.snipe-tasks-title i {
    color: var(--accent);
}
.snipe-tasks-count {
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 4px 12px;
    white-space: nowrap;
}

/* ─── Snipe Targets Panel (table) ─── */
.snipe-targets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.snipe-targets-table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}
.snipe-targets-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
.snipe-target-tr {
    transition: background 0.15s;
}
.snipe-target-tr:hover {
    background: rgba(255, 255, 255, 0.04);
}
.snipe-targets-table .col-player {
    min-width: 220px;
}
.snipe-targets-table .col-qty,
.snipe-targets-table .col-action {
    white-space: nowrap;
}
.snipe-targets-table .col-price,
.snipe-targets-table .col-lastprice {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.snipe-target-tr .player-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.snipe-target-tr .player-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}
.snipe-target-tr .player-info {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}
.snipe-target-tr .player-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 160px;
}
.snipe-target-tr .pos-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    text-transform: uppercase;
}
.snipe-target-tr .ovr-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #1e3a5f;
    color: #60a5fa;
}
.snipe-target-tr .price-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}
.snipe-action-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
}
.snipe-action-tag.action-buy {
    background: rgba(46, 160, 67, 0.15);
    color: #2ea043;
    border: 1px solid rgba(46, 160, 67, 0.3);
}
.snipe-action-tag.action-sell {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}
.snipe-target-tr .status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}
.snipe-target-tr .status-running {
    background: rgba(46, 160, 67, 0.15);
    color: #2ea043;
}
.snipe-target-tr .status-waiting {
    background: rgba(139, 148, 158, 0.15);
    color: #8b949e;
}
.snipe-target-tr .status-triggered {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}
.snipe-target-tr .status-done {
    background: rgba(139, 148, 158, 0.1);
    color: #666;
}
.snipe-target-tr .action-btn {
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.snipe-target-tr .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.snipe-target-tr .action-btn.btn-stop {
    border-color: rgba(218, 54, 51, 0.3);
    color: #da3633;
}
.snipe-target-tr .action-btn.btn-stop:hover {
    background: rgba(218, 54, 51, 0.2);
}
.snipe-target-tr .action-btn.btn-reorder {
    border-color: rgba(46, 160, 67, 0.3);
    color: #2ea043;
}
.snipe-target-tr .action-btn.btn-reorder:hover {
    background: rgba(46, 160, 67, 0.2);
}
.grade-badge-sm {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Card tier badge */
.tier-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    flex-shrink: 0;
}

/* ─── Snipe Quick Add form ─── */
.snipe-quickadd {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: visible;
}
.snipe-quickadd-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.snipe-quickadd-head i {
    color: var(--accent);
}
.snipe-quickadd-body {
    padding: 16px 18px 18px;
}
.sqa-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 6px;
}
.sqa-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    background: rgba(13, 17, 23, 0.9);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.sqa-input:focus {
    border-color: var(--accent);
}
select.sqa-input {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.sqa-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.sqa-ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.12s;
}
.sqa-ac-item:hover {
    background: rgba(255, 255, 255, 0.06);
}
.sqa-selected {
    margin-top: 8px;
    font-size: 12px;
    color: #fff;
    padding: 8px 10px;
    background: rgba(46, 160, 67, 0.08);
    border: 1px solid rgba(46, 160, 67, 0.25);
    border-radius: 8px;
}
.sqa-hint {
    font-size: 12px;
    color: #666;
    margin: 8px 0 14px;
}
.sqa-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.sqa-col {
    flex: 1;
    min-width: 120px;
}
.sqa-submit {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, opacity 0.15s;
    box-shadow: 0 5px 15px rgba(34, 197, 94, 0.28);
}
.sqa-submit:hover:not(:disabled) {
    background: #22c55e;
}
.sqa-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   Coupon picker (Nhận BP hàng loạt) — dropdown tự vẽ, menu "portal" ra body
   để không bị cắt bởi danh sách thẻ có overflow-y: auto.
   ========================================================================== */
.cpn-select { position: relative; flex: 1; min-width: 0; }

.cpn-select__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 7px 10px;
    background: rgba(22, 27, 34, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.cpn-select__trigger:hover {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.06);
}

.cpn-select.open .cpn-select__trigger {
    border-color: var(--accent);
    background: rgba(34, 197, 94, 0.1);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.cpn-select__trigger.is-active {
    border-color: rgba(46, 160, 67, 0.5);
    background: rgba(46, 160, 67, 0.08);
}

.cpn-select__trigger.is-active:hover {
    border-color: rgba(46, 160, 67, 0.8);
}

.cpn-select__icon { color: var(--text-secondary); font-size: 11px; flex-shrink: 0; }
.cpn-select__trigger.is-active .cpn-select__icon { color: var(--success); }

.cpn-select__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cpn-select__value { color: var(--success); font-weight: 800; flex-shrink: 0; }

.cpn-select__pill {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.cpn-select__pill--out { background: rgba(218, 54, 51, 0.18); color: #f87171; }
.cpn-select__pill--on { background: rgba(46, 160, 67, 0.18); color: #3fb950; }

.cpn-select__caret {
    color: var(--text-secondary);
    font-size: 10px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.cpn-select.open .cpn-select__caret { transform: rotate(180deg); }

.cpn-menu {
    position: fixed;
    z-index: 5000;
    display: none;
    padding: 5px;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(16, 20, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(14px);
}

.cpn-menu.show { display: block; animation: cpnIn 0.12s ease-out; }

@keyframes cpnIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.cpn-menu__head {
    padding: 7px 10px 6px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.cpn-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.14s;
}

.cpn-opt:hover { background: rgba(255, 255, 255, 0.07); }
.cpn-opt.selected { background: rgba(34, 197, 94, 0.16); }

.cpn-opt.disabled { opacity: 0.45; cursor: not-allowed; }
.cpn-opt.disabled:hover { background: none; }

.cpn-opt__check { width: 13px; flex-shrink: 0; text-align: center; color: var(--accent); font-size: 11px; }
.cpn-opt__main { flex: 1; min-width: 0; }

.cpn-opt__name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cpn-opt__sub { font-size: 10.5px; color: var(--text-secondary); margin-top: 1px; }
.cpn-opt.selected .cpn-opt__name { color: #fff; }
.cpn-opt__value { font-size: 12.5px; font-weight: 800; color: var(--success); flex-shrink: 0; }
.cpn-opt.disabled .cpn-opt__value { color: var(--text-secondary); }

/* ------------------------------------------------------------------------
   Renewal notice (static/modules/renewal.js)

   Modelled on the notification panel used elsewhere in the product family:
   bell + kicker/title header, hairline divider, a right-aligned timestamp, the
   body, and a countdown footer. Uses the page's own tokens (Inter, glass bg,
   20px radius) so it reads as part of the app rather than an embedded widget.

   It is a fixed overlay, NOT part of the document flow: body is display:flex,
   so a banner child would become a side-by-side column.
   ------------------------------------------------------------------------ */
.renewal-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 8, 14, 0.66);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: renewalFade 0.2s ease-out;
}

.renewal-overlay.hidden { display: none; }

body.renewal-locked { overflow: hidden; }

@keyframes renewalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes renewalRise {
    from { opacity: 0; transform: translateY(18px) scale(0.975); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.renewal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary, #f0f6fc);
    animation: renewalRise 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    box-sizing: border-box;
    scrollbar-width: thin;
}

/* Urgency accent: a top hairline, so the header keeps its calm look. */
.renewal-card.phase-normal { border-top: 2px solid var(--accent); }
.renewal-card.phase-soon { border-top: 2px solid var(--warning, #d29922); }
.renewal-card.phase-due { border-top: 2px solid var(--danger, #da3633); }

/* ---- header ---- */
.renewal-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
}

.renewal-bell {
    font-size: 13px;
    color: var(--text-secondary, #8b949e);
}

.renewal-kicker {
    font-size: 0.8rem;
    color: var(--text-secondary, #8b949e);
    font-weight: 500;
}

.renewal-title {
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--text-primary, #f0f6fc);
}

.renewal-card.phase-soon .renewal-title { color: #e3b341; }
.renewal-card.phase-due .renewal-title { color: #ff7b72; }

.renewal-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #8b949e);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.renewal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #f0f6fc);
}

.renewal-divider {
    height: 1px;
    background: var(--glass-border, rgba(255, 255, 255, 0.08));
    flex-shrink: 0;
}

/* ---- body ---- */
.renewal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 18px;
}

.renewal-stamp {
    text-align: right;
    font-size: 0.74rem;
    color: var(--text-secondary, #8b949e);
    font-variant-numeric: tabular-nums;
}

.renewal-message {
    font-size: 0.94rem;
    line-height: 1.55;
    color: #c9d1d9;
}

.renewal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.renewal-plan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary, #8b949e);
}

.renewal-plan i { font-size: 11px; }

.renewal-price {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: var(--accent);
    font-weight: 700;
}

/* ---- QR panel: shown when a payment link exists ---- */
.renewal-pay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 16px 16px;
    border-radius: 16px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(34, 197, 94, 0.10), transparent 65%),
        rgba(0, 0, 0, 0.34);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
}

.renewal-pay-amount {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary, #f0f6fc);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.renewal-pay-amount span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary, #8b949e);
    margin-left: 3px;
}

/* A big, scannable code: 240px on desktop, still 200px on a phone. */
.renewal-qr-wrap {
    position: relative;
    line-height: 0;
    border-radius: 14px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.renewal-qr {
    display: block;
    width: 240px;
    height: 240px;
    object-fit: contain;
    border-radius: 6px;
}

.renewal-qr-fallback {
    display: none;
    width: 240px;
    padding: 28px 12px;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #b42318;
    background: #fff;
    border-radius: 6px;
}

.renewal-qr-wrap.is-broken img { display: none; }
.renewal-qr-wrap.is-broken .renewal-qr-fallback { display: block; }

.renewal-bank {
    text-align: center;
    font-size: 0.82rem;
    color: #c9d1d9;
    word-break: break-word;
    max-width: 100%;
}

.renewal-memo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.09);
    border: 1px dashed rgba(34, 197, 94, 0.35);
    max-width: 100%;
    box-sizing: border-box;
}

.renewal-memo-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #8b949e);
    flex-shrink: 0;
}

.renewal-memo code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.84rem;
    font-weight: 600;
    color: #86efac;
    user-select: all;
    word-break: break-all;
    min-width: 0;
}

.renewal-copy {
    border: none;
    background: transparent;
    color: var(--text-secondary, #8b949e);
    cursor: pointer;
    padding: 3px 4px;
    border-radius: 6px;
    flex-shrink: 0;
    font-size: 12px;
}

.renewal-copy:hover { color: var(--accent); background: rgba(34, 197, 94, 0.12); }

.renewal-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.renewal-link:hover { color: var(--accent-hover, #16a34a); text-decoration: underline; }
.renewal-link i { font-size: 11px; }

.renewal-contact {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.34);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    font-size: 0.88rem;
    white-space: pre-wrap;
    color: #c9d1d9;
}

.renewal-contact-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #8b949e);
}

/* ---- buttons ---- */
.renewal-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(180deg, #4ade80, var(--accent));
    color: #05121f;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

.renewal-cta:hover { filter: brightness(1.07); }
.renewal-cta:active { transform: translateY(1px); }
.renewal-cta:disabled { opacity: 0.6; cursor: default; filter: none; }

.renewal-cta.secondary {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    color: var(--text-primary, #f0f6fc);
    font-weight: 600;
}

.renewal-cta.secondary:hover { background: rgba(255, 255, 255, 0.11); }

/* ---- footer countdown ---- */
.renewal-foot { display: flex; }

.renewal-foot-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #8b949e);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
}

.renewal-foot-btn:hover { color: var(--text-primary, #f0f6fc); }

/* ---- floating chip (reopens the popup) ---- */
.renewal-chip {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 11000;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 999px;
    border: 1px solid rgba(34, 197, 94, 0.45);
    background: rgba(22, 27, 34, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--accent);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.renewal-chip:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: rgba(22, 27, 34, 0.98);
}

.renewal-chip.hidden { display: none; }

.renewal-chip.urgent {
    border-color: rgba(218, 54, 51, 0.6);
    color: #ff7b72;
    animation: renewalPulse 2.4s ease-in-out infinite;
}

@keyframes renewalPulse {
    0%, 100% { box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6); }
    50% { box-shadow: 0 10px 30px -8px rgba(218, 54, 51, 0.55); }
}

@media (max-width: 520px) {
    /* Centred on a phone too, not pinned to the bottom: a sheet sliding up from
       the edge reads as a system nag, and the QR ends up half under the thumb. */
    .renewal-overlay { padding: 12px; align-items: center; }
    .renewal-card { max-width: 100%; border-radius: 20px; }
    .renewal-pay { padding: 14px 12px 12px; }
    .renewal-pay-amount { font-size: 1.7rem; }
    .renewal-qr { width: 200px; height: 200px; }
    .renewal-qr-fallback { width: 200px; }
    .renewal-chip { right: 12px; bottom: 12px; font-size: 0.78rem; padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .renewal-overlay,
    .renewal-card,
    .renewal-chip.urgent { animation: none; }
}

/* Far from the deadline the chip is quiet: no accent colour competing with the
   page, just a way in for someone who wants to renew early. */
.renewal-chip.calm {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-secondary, #8b949e);
    box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.5);
}

.renewal-chip.calm:hover {
    border-color: rgba(34, 197, 94, 0.45);
    color: var(--accent);
}

/* Footer: two real buttons, not bare text links. Both fill the row evenly so the
   footer reads as part of the card instead of a leftover strip. */
.renewal-foot {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px 16px;
}

.renewal-foot-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 11px;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #f0f6fc);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.renewal-foot-btn i { font-size: 12px; opacity: 0.85; }

.renewal-foot-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.renewal-foot-btn:active { transform: translateY(1px); }

/* The dismissing action is the primary one once the QR is up (the customer has
   finished the task), so it carries the accent. */
.renewal-foot-btn.primary {
    background: linear-gradient(180deg, #4ade80, var(--accent));
    border-color: transparent;
    color: #05121f;
}

.renewal-foot-btn.primary:hover { filter: brightness(1.07); background: linear-gradient(180deg, #4ade80, var(--accent)); }

.renewal-foot-btn.hidden { display: none; }

/* One button alone should not stretch into a full-width bar. */
.renewal-foot-btn:only-child { flex: 0 1 auto; margin-left: auto; min-width: 140px; }

@media (max-width: 520px) {
    .renewal-foot { padding: 12px 12px 14px; gap: 8px; }
    .renewal-foot-btn { font-size: 0.82rem; min-height: 40px; padding: 9px 10px; }
    .renewal-foot-btn:only-child { min-width: 0; flex: 1 1 100%; }
}

/* ==========================================================================
   Snipe quick add — mode switch (Auto Snipe / Auto Sell), owned-card picker
   and the per-task Rescan switch in the task table.
   ========================================================================== */
.sqa-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.sqa-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #8b949e;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.sqa-mode-btn small {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.7;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.sqa-mode-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}
.sqa-mode-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.sqa-mode-btn i {
    font-size: 11px;
}
#sqaModeBuy.is-active {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}
#sqaModeSell.is-active {
    background: linear-gradient(145deg, #f97316, #c2410c);
    color: #fff;
    box-shadow: 0 4px 12px rgba(194, 65, 12, 0.35);
}

/* Grade is intrinsic to an owned card: show it as a chip instead of a select. */
.sqa-locked {
    display: flex;
    align-items: center;
    gap: 7px;
    box-sizing: border-box;
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: #f0b429;
    font-size: 13px;
    font-weight: 800;
}
.sqa-locked span {
    color: #8b949e;
    font-size: 11px;
    font-weight: 600;
}

.sqa-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sqa-options .rescan-toggle {
    margin-top: 0;
}

/* Sell mode tints the primary action (matching the Auto Sell modal). */
.snipe-quickadd.is-sell .sqa-submit {
    background: #c2410c;
    box-shadow: 0 5px 15px rgba(194, 65, 12, 0.35);
}
.snipe-quickadd.is-sell .sqa-submit:hover:not(:disabled) {
    background: #ea580c;
}


.sqa-ac-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.sqa-ac-main strong {
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sqa-ac-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sqa-ac-empty {
    padding: 10px;
    color: #8b949e;
    text-align: center;
    font-size: 12px;
}

/* ── Per-task Rescan switch in the task table ── */
.snipe-rescan-cell {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.snipe-rs-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex: 0 0 32px;
    cursor: pointer;
}
.snipe-rs-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.snipe-rs-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.14);
    transition: background 0.18s ease, border-color 0.18s ease;
}
.snipe-rs-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.18s ease;
}
.snipe-rs-switch input:checked + .snipe-rs-slider {
    background: rgba(46, 160, 67, 0.85);
    border-color: rgba(46, 160, 67, 0.9);
}
.snipe-rs-switch input:checked + .snipe-rs-slider::before {
    transform: translateX(14px);
}
.snipe-rs-switch input:focus-visible + .snipe-rs-slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.snipe-rs-switch input:disabled + .snipe-rs-slider {
    opacity: 0.4;
    cursor: not-allowed;
}
.snipe-rs-label {
    font-size: 10.5px;
    font-weight: 700;
    color: #6e7681;
}
.snipe-rs-label.on {
    color: #3fb950;
}

/* Picker: owned-copy count + a taller list (kho rows carry price and grade). */
.sqa-ac-copies {
    flex: 0 0 auto;
    font-size: 10.5px;
    font-weight: 800;
    color: #8b949e;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    padding: 1px 7px;
    white-space: nowrap;
}
.sqa-autocomplete {
    max-height: 330px;
}
.sqa-options .rescan-toggle__text {
    font-size: 11.5px;
    line-height: 1.35;
}

/* ── Kho cầu thủ: modal chọn thẻ để bán (Auto Sell) ── */
.kho-modal {
    width: min(94vw, 900px);
    max-width: 900px;
    max-height: 84vh;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.kho-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.kho-head h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #fff;
}
.kho-head h3 i { color: var(--accent); }
.kho-count {
    font-size: 12px;
    font-weight: 700;
    color: #8b949e;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 3px 10px;
}
.kho-head .open-modal-close { margin-left: auto; }
.kho-search { position: relative; padding: 12px 20px 10px; }
.kho-search i {
    position: absolute;
    left: 31px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b949e;
    font-size: 12px;
    pointer-events: none;
}
.kho-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px 10px 44px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 13px;
}
.kho-search input:focus { outline: none; border-color: var(--accent); }
.kho-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.kho-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kho-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: left;
    padding: 9px 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #7d8590;
    background: rgba(13, 17, 23, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}
.kho-table tbody td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
.kho-row { cursor: pointer; transition: background 0.12s ease; }
.kho-row:hover { background: rgba(34, 197, 94, 0.09); }
.kho-row.is-selected {
    background: rgba(240, 180, 41, 0.12);
    box-shadow: inset 3px 0 0 #f0b429;
}
.kho-player { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.kho-face {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
}
.kho-face-fb {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: #555;
}
.kho-name {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.kho-season {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    font-size: 10.5px;
    color: #7d8590;
}
.kho-season img { height: 14px; object-fit: contain; }
.kho-col-grade, .kho-col-ovr, .kho-col-pos, .kho-col-value { white-space: nowrap; }
.kho-col-ovr, .kho-col-value { text-align: right; font-variant-numeric: tabular-nums; }
.kho-value { font-weight: 800; color: #f0b429; }
.kho-pick-btn {
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    font-size: 11.5px;
    font-weight: 800;
    border-radius: 7px;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
}
.kho-row:hover .kho-pick-btn {
    background: rgba(34, 197, 94, 0.22);
    color: #cae8ff;
}
.kho-empty { padding: 26px 16px; text-align: center; color: #6e7681; font-size: 13px; }
.kho-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.kho-hint { font-size: 11.5px; color: #8b949e; }
@media (max-width: 640px) {
    .kho-modal { max-height: 88vh; }
    .kho-col-pos { display: none; }
}

/* Sell mode: the player field is a trigger for the kho modal, not a text box. */
.snipe-quickadd.is-sell #sqaSearchInput {
    cursor: pointer;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ── Kho modal: nhóm đội hình / kho, cấp bằng ảnh level, số canh dưới nhãn ── */
.kho-table thead th.kho-col-grade,
.kho-table thead th.kho-col-ovr,
.kho-table thead th.kho-col-value,
.kho-table tbody td.kho-col-grade,
.kho-table tbody td.kho-col-ovr,
.kho-table tbody td.kho-col-value {
    text-align: center;
}
.kho-table tbody td.kho-col-grade .grade-icon {
    width: 34px;
    height: 20px;
    margin: 0 auto;
    display: block;
}
.kho-section-row td {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.025);
}
.kho-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #8b949e;
}
.kho-section-head i { color: var(--accent); font-size: 11px; }
.kho-section-title { color: #c9d1d9; }
.kho-section-count {
    font-size: 10px;
    font-weight: 800;
    color: #8b949e;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 1px 8px;
}
.kho-section-value {
    margin-left: auto;
    font-size: 11px;
    font-weight: 800;
    color: #f0b429;
    letter-spacing: 0;
    text-transform: none;
    font-variant-numeric: tabular-nums;
}
.kho-state {
    font-size: 9.5px;
    font-weight: 800;
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.35);
    background: rgba(167, 139, 250, 0.1);
    border-radius: 4px;
    padding: 0 5px;
    white-space: nowrap;
}

/* Mobile: bỏ cột vị trí + nút "Chọn" (bấm cả dòng để chọn) để bảng vừa 1 màn hình */
@media (max-width: 640px) {
    .kho-col-pos,
    .kho-col-pick {
        display: none;
    }
    .kho-table thead th,
    .kho-table tbody td {
        padding-left: 10px;
        padding-right: 10px;
    }
    .kho-name {
        max-width: 150px;
    }
    .kho-section-value {
        font-size: 10.5px;
    }
}

/* ── Thẻ đã chọn trong form "Thêm cầu thủ" ── */
.sqa-selected {
    padding: 0;
    background: none;
    border: none;
}
.sqp-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(46, 160, 67, 0.28);
    background: linear-gradient(180deg, rgba(46, 160, 67, 0.1), rgba(46, 160, 67, 0.03));
}
.sqp-face {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
}
.sqp-face-fb {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: #555;
}
.sqp-body {
    flex: 1;
    min-width: 0;
}
.sqp-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sqp-season {
    height: 14px;
    flex: 0 0 auto;
    object-fit: contain;
}
.sqp-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 11px;
    color: #8b949e;
    flex-wrap: wrap;
}
.sqp-lvl {
    width: 30px;
    height: 18px;
    flex: 0 0 auto;
    object-fit: contain;
}

.sqp-ovr {
    font-weight: 800;
    color: #c9d1d9;
}
.sqp-copies {
    color: #8b949e;
    font-weight: 700;
}
.sqp-side {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}
.sqp-price {
    font-size: 12.5px;
    font-weight: 800;
    color: #f0b429;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.sqp-reset {
    font-size: 10.5px;
    color: #8b949e;
    white-space: nowrap;
}
.sqp-action {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #c9d1d9;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.sqp-action:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* Grade của thẻ trong kho: ảnh level + chữ, không phải ô nhập */
.sqa-locked {
    gap: 8px;
}
.sqa-locked img {
    width: 32px;
    height: 19px;
    object-fit: contain;
}

.sqa-locked small {
    color: #8b949e;
    font-size: 10.5px;
    font-weight: 600;
}

.sqa-locked {
    white-space: nowrap;
    overflow: hidden;
}
.sqa-locked small {
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 640px) {
    .sqp-action {
        padding: 5px 11px;
        font-size: 11px;
        min-height: 26px;
    }
    .sqp-face,
    .sqp-face-fb {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }
}

/* Ảnh level gọn hơn cho cân với cỡ chữ 11-13px */
.sqp-lvl {
    width: 24px;
    height: 14px;
}
.sqa-locked img {
    width: 26px;
    height: 15px;
}
.kho-table tbody td.kho-col-grade .grade-icon {
    width: 28px;
    height: 17px;
}

/* Trạng thái: nhãn "Bảo vệ giá đã rải" cho task có bật protect_placed_price */
.snipe-protect-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(34, 197, 94, 0.28);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
}

/* Cấp trong bảng task: ảnh level thay cho badge chữ */
.snipe-target-tr .grade-icon {
    width: 26px;
    height: 15px;
    flex: 0 0 auto;
}

/* ── Bảng task: hàng thoáng hơn, trạng thái xếp dọc, thao tác canh phải ── */
.snipe-targets-table thead th {
    padding: 12px 14px;
}
.snipe-targets-table tbody td {
    padding: 13px 14px;
}
.snipe-targets-table tbody tr.snipe-target-tr {
    height: 62px;
}
.snipe-targets-table .col-qty,
.snipe-targets-table .col-action {
    width: 92px;
}
.snipe-targets-table .col-rescan {
    width: 104px;
}
.snipe-targets-table .col-status {
    width: 158px;
}
.snipe-targets-table .col-actions {
    width: 104px;
    text-align: right;
}
.snipe-targets-table thead th.col-actions {
    text-align: right;
}
.snipe-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}
.snipe-sell-state {
    font-size: 10px;
    font-weight: 700;
}
.snipe-sell-state.is-ready {
    color: #2ea043;
}
.snipe-sell-state.is-pending {
    color: #d29922;
}
.snipe-protect-tag {
    margin-top: 0;
}

/* ── Themed dropdown (thay popup trắng mặc định của <select>) ── */
.fsel {
    position: relative;
}
.fsel-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}
.fsel-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.fsel-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.fsel-label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.fsel-chev {
    flex: 0 0 auto;
    font-size: 10px;
    color: #8b949e;
    transition: transform 0.15s ease;
}
.fsel-trigger[aria-expanded="true"] .fsel-chev {
    transform: rotate(180deg);
}
.fsel-menu {
    position: fixed;
    z-index: 3000;
    display: none;
    /* Wheel over the menu must scroll the menu, not the page behind it: a page
       scroll would close the menu (the close-on-scroll listener). */
    overscroll-behavior: contain;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #161b22;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    scrollbar-width: thin;
}
.fsel-menu.show {
    display: block;
}
.fsel-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #c9d1d9;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.fsel-option:hover,
.fsel-option.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.fsel-option.is-selected {
    color: #4ade80;
    font-weight: 700;
}
.fsel-opt-label {
    overflow: hidden;
    text-overflow: ellipsis;
}
.fsel-check {
    flex: 0 0 auto;
    font-size: 10px;
    opacity: 0;
}
.fsel-option.is-selected .fsel-check {
    opacity: 1;
}

/* ── Auto Sell: danh sách thẻ chờ thêm (multi-pick) ── */
.sqp-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sqp-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 9px;
    border: 1px solid rgba(46, 160, 67, 0.22);
    background: rgba(46, 160, 67, 0.06);
}
.sqp-row-face {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
}
.sqp-row-lvl {
    width: 24px;
    height: 14px;
    flex: 0 0 auto;
    object-fit: contain;
}
.sqp-row-main {
    flex: 1;
    min-width: 0;
}
.sqp-row-name {
    font-size: 12.5px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sqp-row-sub {
    font-size: 10.5px;
    color: #8b949e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sqp-row-price {
    font-size: 11.5px;
    font-weight: 800;
    color: #f0b429;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.sqp-row-del {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #8b949e;
    font-size: 10px;
    cursor: pointer;
}
.sqp-row-del:hover {
    background: rgba(218, 54, 51, 0.18);
    border-color: rgba(218, 54, 51, 0.4);
    color: #ff7b72;
}
.sqp-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
    padding: 7px;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    background: transparent;
    color: #8b949e;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sqp-add:hover {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.08);
    color: #86efac;
}

/* Tên trước, ảnh mùa sau; ảnh level xuống dòng phụ */
.sqp-row-name {
    display: flex;
    align-items: center;
    gap: 5px;
}
.sqp-row-season {
    height: 13px;
    flex: 0 0 auto;
    object-fit: contain;
}
.sqp-row-sub {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Hàng chờ: MÙA -> TÊN -> MỨC THẺ CỘNG (giá và nút xoá bên phải) */
.sqp-row {
    gap: 9px;
}
.sqp-row-season {
    width: 22px;
    height: 16px;
    flex: 0 0 22px;
    object-fit: contain;
    display: inline-block;
}
.sqp-row-name {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sqp-row-grade {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.sqp-row-lvl {
    width: 24px;
    height: 14px;
    object-fit: contain;
}
.sqp-row-del {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

/* Giá bám mép phải, tên không kéo giãn để cụm mùa-tên-cấp đứng sát nhau */
.sqp-row-name {
    flex: 0 1 auto;
    max-width: 62%;
}
.sqp-row-price {
    margin-left: auto;
}

/* Nút "Chọn thêm thẻ nữa" dưới card đơn + nút xoá gọn */
.sqa-selected .sqp-add {
    margin-top: 7px;
}
.sqp-action--del {
    padding: 3px 8px;
    line-height: 1;
}
.sqp-action--del i {
    font-size: 10px;
}
/* ==================== Auto Upgrade — Spam đập thẻ (2 cột: cài đặt | nhật ký) ==================== */
.ug-shell { display: flex; flex-direction: column; gap: 14px; }
.ug-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 1100px) { .ug-layout { grid-template-columns: minmax(0, 1fr); } }
.ug-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ug-monitor { position: sticky; top: 12px; }
@media (max-width: 1100px) { .ug-monitor { position: static; } }

.ug-card {
    background: var(--surface-2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 0;
}
.ug-card--warn { background: linear-gradient(160deg, rgba(245, 158, 11, 0.06), var(--surface-2) 60%); border-color: rgba(245, 158, 11, 0.22); }
.ug-card--accent { background: linear-gradient(160deg, rgba(34, 197, 94, 0.07), var(--surface-2) 55%); border-color: rgba(34, 197, 94, 0.25); }
.ug-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ug-card-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-secondary); }
.ug-step {
    display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
    background: var(--accent-soft); border: 1px solid var(--accent-line); color: #86efac; font-size: 11px; font-weight: 800;
}
.ug-field > label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.ug-input {
    width: 100%; background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 8px;
    padding: 9px 10px; color: var(--text-primary); font-size: 13px; outline: none; transition: border-color 160ms ease, box-shadow 160ms ease;
}
.ug-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12); }
.ug-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ug-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
@media (max-width: 560px) { .ug-grid-3 { grid-template-columns: 1fr 1fr; } }
.ug-hint { font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.ug-hint--warn { color: #f2cc60; }

.ug-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; cursor: pointer;
    padding: 7px 12px; font-size: 12px; font-weight: 700; border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04); color: var(--text-primary); transition: background 160ms ease, border-color 160ms ease;
    white-space: nowrap;
}
.ug-btn:hover { background: rgba(255, 255, 255, 0.08); }
.ug-btn--accent { background: var(--accent-soft); border-color: var(--accent-line); color: #86efac; }
.ug-btn--accent:hover { background: rgba(34, 197, 94, 0.2); }
.ug-btn--danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); color: #f87171; }
.ug-btn--danger:hover { background: rgba(239, 68, 68, 0.2); }

/* Thẻ mục tiêu */
.ug-hero-main { display: flex; align-items: center; gap: 14px; }
.ug-hero-face {
    width: 72px; height: 72px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center;
    background: radial-gradient(circle at 50% 35%, rgba(34, 197, 94, 0.22), rgba(255, 255, 255, 0.02) 70%);
    border: 1px solid var(--accent-line); overflow: hidden;
}
.ug-hero-face img { width: 68px; height: 68px; object-fit: contain; }
.ug-hero-info { flex: 1; min-width: 0; }
.ug-hero-name { display: flex; align-items: center; gap: 7px; font-size: 18px; font-weight: 800; color: #fff; }
.ug-hero-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ug-hero-name img { height: 18px; flex-shrink: 0; }
.ug-hero-meta { margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.ug-hero-meta b { color: var(--text-primary); }
.ug-hero-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0 6px; color: var(--text-secondary); font-size: 13px; text-align: center; }
.ug-grade-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; margin-top: 14px; }
.ug-grade-box {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px;
    border-radius: 10px; background: var(--surface-1); border: 1px solid var(--glass-border); min-height: 46px;
}
.ug-grade-box > span { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.ug-grade-box select { width: auto; min-width: 84px; padding: 6px 8px; }
.ug-grade-arrow { color: var(--accent); font-size: 16px; }

/* Nút chạy */
.ug-actions { position: sticky; bottom: 10px; z-index: 5; height: 48px; }
.ug-actions > button {
    position: absolute; inset: 0; width: 100%; border-radius: 10px; font-size: 15px; font-weight: 800; cursor: pointer;
    transition: opacity 220ms ease, transform 220ms ease; box-shadow: 0 10px 24px rgba(1, 4, 9, 0.45);
}
.ug-start { background: linear-gradient(135deg, #22c55e, #16a34a); border: 1px solid rgba(46, 160, 67, 0.7); color: #fff; }
.ug-start:hover { filter: brightness(1.06); }
.ug-stop { background: #2a1416; border: 1px solid rgba(239, 68, 68, 0.55); color: #f87171; }

/* Cột nhật ký */
.ug-mon { display: flex; flex-direction: column; gap: 12px; }
.ug-mon-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ug-mon-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--text-primary); }
.ug-mon-title i { color: var(--accent); }
.ug-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.3px; }
.ug-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ug-pill--idle { background: rgba(110, 118, 129, 0.18); color: #9da7b3; }
.ug-pill--run { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.ug-pill--run::before { animation: ug-pulse 1.2s ease-in-out infinite; }
.ug-pill--pause { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
@keyframes ug-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.ug-mon-target { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--glass-border); }
.ug-mon-target img.face { width: 40px; height: 40px; object-fit: contain; }
.ug-mon-target .name { font-weight: 800; color: #fff; font-size: 13px; }
.ug-mon-target .sub { font-size: 11px; color: var(--text-secondary); }
.ug-mon-target .grades { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--accent); }
.ug-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ug-stat { padding: 9px 10px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--glass-border); }
.ug-stat > span { display: block; font-size: 10.5px; color: var(--text-secondary); }
.ug-stat > b { display: block; margin-top: 2px; font-size: 16px; color: var(--text-primary); }
.ug-stat > small { display: block; font-size: 10px; color: var(--text-dim); }
.ug-stat--ok > b { color: #4ade80; }
.ug-stat--fail > b { color: #f87171; }
.ug-stat--cost > b { color: #f2cc60; }
.ug-stat--prob > b { color: #a78bfa; }
.ug-mon-note { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.ug-log-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.ug-log {
    height: clamp(280px, calc(100vh - 430px), 680px); overflow-y: auto; padding: 8px 10px; border-radius: 10px;
    background: #070a0e; border: 1px solid var(--glass-border);
    font-family: Consolas, 'Courier New', monospace; font-size: 11.5px; line-height: 1.5; color: #9da7b3;
}
.ug-log > div { padding: 3px 0; border-bottom: 1px dashed rgba(240, 246, 252, 0.06); word-break: break-word; }
.ug-log-empty { color: var(--text-dim); font-family: 'Inter', sans-serif; padding: 18px 4px; text-align: center; }
/* Bảo vệ BP: không bao giờ tràn khỏi card (điện thoại) */
.ug-bp-wrap { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; min-width: 0; }
.ug-bp-toggle { max-width: 100%; }
.ug-bp-text { min-width: 0; }
@media (max-width: 560px) {
    .ug-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .ug-field--price { grid-column: 1 / -1; }
    .ug-bp-wrap { align-items: stretch; }
    .ug-bp-toggle { width: 100%; }
    .ug-bp-text { flex: 1; }
    .ug-hero-main { flex-wrap: wrap; }
    .ug-grade-row { gap: 6px; }
    .ug-grade-box { padding: 6px 8px; }
    .ug-card { padding: 12px; }
}
