:root {
    --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "DM Mono", Consolas, monospace;
    --bg: #080a0d;
    --panel: rgba(16, 19, 23, 0.78);
    --panel-strong: rgba(22, 26, 31, 0.94);
    --input: rgba(255, 255, 255, 0.055);
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(90, 214, 179, 0.34);
    --text: #f3f8f6;
    --muted: #8d9995;
    --soft: #56615d;
    --primary: #5ad6b3;
    --primary-ink: #05110d;
    --accent: #ffcb66;
    --danger: #ff7182;
    --radius: 8px;
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.light {
    --bg: #eef2ef;
    --panel: rgba(255, 255, 255, 0.78);
    --panel-strong: rgba(255, 255, 255, 0.96);
    --input: rgba(8, 10, 13, 0.045);
    --line: rgba(8, 10, 13, 0.1);
    --text: #101417;
    --muted: #53605b;
    --soft: #7b8581;
    --shadow: 0 20px 54px rgba(33, 45, 40, 0.14);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        radial-gradient(circle at 12% -10%, rgba(90, 214, 179, 0.21), transparent 28rem),
        radial-gradient(circle at 94% 12%, rgba(255, 203, 102, 0.14), transparent 25rem),
        linear-gradient(145deg, #07090b, var(--bg));
    background-size: 34px 34px, 34px 34px, auto, auto, auto;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 64px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    padding: 10px max(20px, calc((100vw - 1480px) / 2 + 20px));
    background: rgba(8, 10, 13, 0.75);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

body.light .topbar {
    background: rgba(238, 242, 239, 0.76);
}

.back-link,
.title-block,
.icon-btn,
.btn,
.select-all,
.chip {
    display: inline-flex;
    align-items: center;
}

.back-link {
    gap: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.title-block {
    gap: 12px;
    min-width: 0;
}

.title-icon,
.drop-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--primary-ink);
    background: var(--primary);
}

h1 {
    font-size: clamp(1rem, 2vw, 1.16rem);
    line-height: 1.1;
    letter-spacing: 0;
    white-space: nowrap;
}

.icon-btn {
    justify-self: end;
    width: 38px;
    height: 38px;
    justify-content: center;
    color: var(--muted);
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.app-shell {
    width: min(1480px, calc(100vw - 40px));
    margin: 0 auto;
    padding: 24px 0 42px;
}

.hidden {
    display: none !important;
}

.upload-panel,
.filter-panel,
.results-panel,
.account-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.upload-panel {
    padding: 8px;
}

.drop-zone {
    position: relative;
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.drop-zone:hover,
.drop-zone.dragover {
    background: rgba(90, 214, 179, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.drop-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-icon {
    width: 54px;
    height: 54px;
    font-size: 1.25rem;
}

.workspace {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    animation: fade-in 0.28s var(--ease);
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-panel {
    position: sticky;
    top: 80px;
    align-self: start;
    padding: 12px;
    display: grid;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soft);
    font-size: 0.85rem;
}

input,
select {
    width: 100%;
    min-height: 32px;
    color: var(--text);
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: none;
    font-size: 0.82rem;
}

input {
    padding: 6px 8px;
}

select {
    padding: 6px 7px;
}

.search-box input {
    padding-left: 30px;
}

input:focus,
select:focus {
    border-color: var(--primary);
}

select option {
    color: #101417;
    background: #ffffff;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.filter-grid label {
    display: grid;
    gap: 4px;
}

.filter-grid span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.chip {
    justify-content: center;
    min-height: 28px;
    padding: 4px 6px;
    color: var(--muted);
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.chip.active {
    color: var(--primary-ink);
    background: var(--primary);
    border-color: var(--primary);
}

.panel-actions,
.result-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn {
    min-height: 32px;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    color: var(--text);
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 0.82rem;
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.btn-primary {
    color: var(--primary-ink);
    background: var(--primary);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
}

.results-panel {
    min-width: 0;
    padding: 12px;
}

/* Stats Row Compact */
.stats-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.stats-row div {
    min-height: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--input);
    font-size: 0.82rem;
}

.stats-row strong {
    font-size: 0.95rem;
    color: var(--text);
}

.stats-row span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-toolbar {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.select-all {
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.select-all input,
.account-check {
    width: 16px;
    height: 16px;
    min-height: auto;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Account List & Row Redesign */
.accounts-list {
    display: grid;
    gap: 8px;
}

.account-row {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.account-row:hover {
    border-color: var(--line-strong);
    background: var(--panel-strong);
}

.account-row.row-expanded {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(90, 214, 179, 0.08);
}

.row-header {
    display: grid;
    grid-template-columns: 24px 20px minmax(130px, 1.2fr) 110px minmax(200px, 2fr) minmax(100px, 1fr) 36px;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    cursor: pointer;
    user-select: none;
}

.row-expand-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: color 0.18s var(--ease);
}

.expand-icon {
    font-size: 0.75rem;
    transition: transform 0.18s var(--ease);
}

.expand-icon.expanded {
    transform: rotate(90deg);
    color: var(--primary);
}

.row-identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.row-ingame {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.row-username {
    font-size: 0.72rem;
    color: var(--muted);
    font-family: var(--font-mono);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.row-rank {
    display: flex;
    align-items: center;
}

.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
}

/* Rank Colors */
.rank-thachdau { background: rgba(255, 0, 85, 0.12); color: #ff3377; border: 1px solid rgba(255, 0, 85, 0.2); }
.rank-chientuong { background: rgba(255, 69, 0, 0.12); color: #ff5e1a; border: 1px solid rgba(255, 69, 0, 0.2); }
.rank-caothu { background: rgba(255, 140, 0, 0.12); color: #ffa533; border: 1px solid rgba(255, 140, 0, 0.2); }
.rank-tinhanh { background: rgba(153, 50, 204, 0.12); color: #ba55d3; border: 1px solid rgba(153, 50, 204, 0.2); }
.rank-kimcuong { background: rgba(30, 144, 255, 0.12); color: #33a1ff; border: 1px solid rgba(30, 144, 255, 0.25); }
.rank-bachkim { background: rgba(32, 178, 170, 0.12); color: #20b2aa; border: 1px solid rgba(32, 178, 170, 0.2); }
.rank-vang { background: rgba(255, 215, 0, 0.1); color: #e5c100; border: 1px solid rgba(255, 215, 0, 0.18); }
.rank-bac { background: rgba(192, 192, 192, 0.12); color: #a6a6a6; border: 1px solid rgba(192, 192, 192, 0.2); }
.rank-dong { background: rgba(205, 127, 50, 0.12); color: #cd7f32; border: 1px solid rgba(205, 127, 50, 0.2); }
.rank-normal { background: rgba(102, 102, 102, 0.12); color: #999; border: 1px solid rgba(102, 102, 102, 0.2); }

.row-metrics {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.row-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--muted);
    background: var(--input);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--line);
}

.row-metric b {
    color: var(--text);
}

.row-gold i {
    color: var(--accent);
}

.badge-sss {
    background: rgba(255, 113, 130, 0.1);
    color: #ff7182;
    border-color: rgba(255, 113, 130, 0.18);
    font-weight: 700;
}

.badge-anime {
    background: rgba(255, 203, 102, 0.1);
    color: var(--accent);
    border-color: rgba(255, 203, 102, 0.18);
    font-weight: 700;
}

.badge-ss {
    background: rgba(90, 214, 179, 0.1);
    color: var(--primary);
    border-color: rgba(90, 214, 179, 0.18);
    font-weight: 700;
}

.row-status {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.email-no {
    background: rgba(255, 113, 130, 0.08);
    color: var(--danger);
    border: 1px solid rgba(255, 113, 130, 0.15);
}

.email-yes {
    background: rgba(90, 214, 179, 0.08);
    color: var(--primary);
    border: 1px solid rgba(90, 214, 179, 0.15);
}

.fb-live {
    background: rgba(90, 214, 179, 0.1);
    color: var(--primary);
    border: 1px solid rgba(90, 214, 179, 0.18);
}

.fb-die {
    background: rgba(255, 113, 130, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 113, 130, 0.18);
}

.is-ban {
    background: rgba(255, 0, 0, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.btn-copy-fast {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: var(--input);
    color: var(--muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.18s var(--ease);
}

.btn-copy-fast:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(90, 214, 179, 0.08);
}

/* Expanded Details */
.row-details {
    border-top: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.12);
    padding: 12px 14px;
    animation: slide-down 0.2s var(--ease);
}

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

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 16px;
}

.details-credentials {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.details-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.credential-box {
    display: flex;
    gap: 6px;
    align-items: center;
}

.credential-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line);
    padding: 6px 10px;
    height: 32px;
    min-height: auto;
}

.btn-copy-cred {
    height: 32px;
    min-height: auto;
    padding: 0 12px;
    font-size: 0.78rem;
}

.btn-show-pass {
    height: 32px;
    min-height: auto;
    width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.btn-show-pass:hover {
    color: var(--text);
}

.security-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-top: 6px;
    font-size: 0.78rem;
    border-top: 1px solid var(--line);
    padding-top: 6px;
}

.security-details div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
    padding-bottom: 2px;
}

body.light .security-details div {
    border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
}

.security-details strong {
    color: var(--muted);
    font-weight: 500;
}

.security-details span {
    color: var(--text);
    font-weight: 600;
}

.details-skins {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.skin-group {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--line);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
}

.skin-group-title {
    font-weight: 800;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 2px;
}

.sss-text { color: #ff7182; }
.anime-text { color: var(--accent); }
.ss-text { color: var(--primary); }
.collab-text { color: #818cf8; }

.skin-list-p {
    color: var(--muted);
    line-height: 1.35;
    word-break: break-word;
}

body.light .skin-list-p {
    color: var(--text);
}

.no-special-skins {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--soft);
    font-size: 0.78rem;
    border: 1px dashed var(--line);
    border-radius: 4px;
    padding: 16px;
}

.empty {
    min-height: 200px;
    display: grid;
    place-items: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

/* Toast styling updates */
.toast-root {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    display: grid;
    gap: 8px;
}

.toast {
    min-width: 200px;
    max-width: min(420px, calc(100vw - 36px));
    padding: 10px 12px;
    color: var(--text);
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-weight: 800;
    font-size: 0.82rem;
    animation: toast-in 0.2s var(--ease);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

/* Responsive updates */
@media (max-width: 1180px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        position: static;
    }

    .row-header {
        grid-template-columns: 24px 20px 1.5fr 1fr 1.2fr auto;
    }
}

@media (max-width: 760px) {
    .topbar {
        grid-template-columns: 1fr auto;
    }

    .title-block {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .back-link {
        grid-row: 2;
    }

    .icon-btn {
        grid-row: 2;
    }

    .app-shell {
        width: min(100vw - 20px, 1480px);
        padding-top: 12px;
    }

    .filter-grid,
    .chip-grid {
        grid-template-columns: 1fr 1fr;
    }

    .row-header {
        grid-template-columns: 24px 20px 1fr 90px auto;
        gap: 8px;
        padding: 8px 10px;
    }

    .row-metrics {
        display: none;
    }

    .details-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .filter-grid,
    .chip-grid {
        grid-template-columns: 1fr;
    }
}
