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

:root {
    --bg: #f0f4ff;
    --surface: #ffffff;
    --surface2: #f5f8ff;
    --surface3: #e8eeff;
    --border: #e2eaff;
    --border2: #c8daff;
    --accent: #1a6fe8;
    --accent-dim: rgba(26, 111, 232, .1);
    --success: #10b981;
    --danger: #ef4444;
    --warn: #f59e0b;
    --text: #1a1a2e;
    --muted: #7a9fd8;
    --radius: 14px;
    --rsm: 8px;
    --rmd: 10px;
    --nav-h: 64px;
    --side-w: 230px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Inter, system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5
}

/* ── Login ── */
.login-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 55% 30%, rgba(26, 111, 232, .1) 0%, transparent 65%), var(--bg);
    z-index: 9999
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 22px;
    padding: 44px 36px;
    text-align: center;
    width: min(420px, 92vw);
    box-shadow: 0 8px 32px rgba(26, 111, 232, .1)
}

.login-card img {
    height: 48px;
    margin-bottom: 16px
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 8px
}

.login-card p {
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.6
}

.timeout-notice {
    background: rgba(239, 68, 68, .08);
    border: 1px solid rgba(239, 68, 68, .2);
    color: #dc2626;
    padding: 10px 14px;
    border-radius: var(--rsm);
    margin-bottom: 18px;
    font-weight: 700;
    font-size: 13px
}

.btn-discord {
    background: #5865F2;
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: var(--rmd);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: filter .15s, transform .15s;
    box-shadow: 0 4px 14px rgba(88, 101, 242, .3)
}

.btn-discord:hover {
    filter: brightness(1.08);
    transform: translateY(-1px)
}

/* ── Nav ── */
.navbar {
    height: var(--nav-h);
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 8px rgba(0, 80, 200, .06)
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--text)
}

.nav-brand img {
    height: 28px
}

.nav-brand span {
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent)
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 14px
}

.nav-user {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 600
}

.nav-dot {
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(16, 185, 129, .6)
}

.btn-logout {
    background: rgba(239, 68, 68, .08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, .18);
    padding: 8px 13px;
    border-radius: var(--rsm);
    font-weight: 800;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s
}

.btn-logout:hover {
    background: rgba(239, 68, 68, .15)
}

/* ── Layout ── */
.app {
    display: flex;
    min-height: calc(100vh - var(--nav-h))
}

/* ── Sidebar ── */
.sidebar {
    width: var(--side-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    overflow-y: auto
}

.sb-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 10px 10px 4px;
    margin-top: 6px
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: var(--rsm);
    color: #5a6b8c;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background .12s, color .12s
}

.nav-item:hover {
    background: var(--surface2);
    color: var(--accent)
}

.nav-item.active {
    background: var(--accent);
    color: #fff
}

.nav-item i {
    width: 16px;
    text-align: center;
    flex-shrink: 0
}

.badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 99px;
    min-width: 18px;
    text-align: center
}

.nav-item.active .badge-count {
    background: #fff;
    color: var(--accent)
}

/* ── Main ── */
.main {
    flex: 1;
    padding: 24px 28px;
    overflow-x: hidden;
    min-width: 0
}

.tab-panel {
    display: none
}

.tab-panel.active {
    display: block;
    animation: fadeIn .2s ease
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ── Page header ── */
.page-hdr {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px
}

.page-hdr h1 {
    font-size: 1.4rem;
    font-weight: 900;
    color: #0f1b33
}

.page-hdr p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px
}

/* ── Toolbar ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(26, 111, 232, .05)
}

.search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--rsm);
    padding: 8px 12px;
    flex: 1;
    min-width: 180px
}

.search-wrap input {
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    width: 100%
}

.search-wrap input::placeholder {
    color: var(--muted)
}

.pill {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
    white-space: nowrap
}

.pill:hover {
    color: var(--accent);
    border-color: var(--border2)
}

.pill.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

.mod-count-label {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap
}

/* ── Mod grid (mirrors index.html style) ── */
.mods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px
}

.mod-group {
    margin-bottom: 28px
}

.group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border)
}

.group-letter {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    width: 36px;
    flex-shrink: 0
}

.group-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700
}

/* Card */
.mod-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    position: relative
}

.mod-card:hover {
    border-color: var(--border2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 111, 232, .12)
}

.card-thumb {
    height: 140px;
    background: var(--surface2);
    position: relative;
    overflow: hidden;
    flex-shrink: 0
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.thumb-purple {
    background: linear-gradient(135deg, #7c3aed, #a78bfa)
}

.thumb-pink {
    background: linear-gradient(135deg, #ec4899, #f9a8d4)
}

.thumb-green {
    background: linear-gradient(135deg, #10b981, #6ee7b7)
}

.thumb-yellow {
    background: linear-gradient(135deg, #f59e0b, #fcd34d)
}

.thumb-blue {
    background: linear-gradient(135deg, #1a6fe8, #7eb1ff)
}

.thumb-cyan {
    background: linear-gradient(135deg, #06b6d4, #67e8f9)
}

.thumb-red {
    background: linear-gradient(135deg, #ef4444, #fca5a5)
}

.thumb-teal {
    background: linear-gradient(135deg, #14b8a6, #5eead4)
}

.thumb-orange {
    background: linear-gradient(135deg, #f97316, #fdba74)
}

.card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start
}

.badge-ver {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .05em
}

.badge-fs22 {
    background: rgba(26, 111, 232, .9);
    color: #fff
}

.badge-fs25 {
    background: rgba(16, 185, 129, .9);
    color: #fff
}

.badge-fs19 {
    background: rgba(245, 158, 11, .9);
    color: #000
}

.badge-broken {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(239, 68, 68, .92);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px
}

.badge-ea {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(245, 158, 11, .92);
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px
}

.badge-community {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 111, 232, .9);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    text-align: center
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1
}

.card-title {
    font-weight: 800;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f1b33
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap
}

.cat-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: capitalize;
    background: var(--surface3);
    color: var(--muted)
}

.cat-rides {
    background: rgba(124, 58, 237, .12);
    color: #7c3aed
}

.cat-stalls {
    background: rgba(16, 185, 129, .12);
    color: #0d9668
}

.cat-trucks {
    background: rgba(26, 111, 232, .12);
    color: #1a6fe8
}

.cat-addons {
    background: rgba(245, 158, 11, .12);
    color: #b45309
}

.cat-others {
    background: rgba(122, 159, 216, .15);
    color: #5a6b8c
}

.card-date {
    font-size: 11px;
    color: var(--muted);
    margin-left: auto
}

.card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto
}

.btn-edit {
    flex: 1;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(26, 111, 232, .2);
    padding: 7px 10px;
    border-radius: var(--rsm);
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    transition: background .12s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px
}

.btn-edit:hover {
    background: rgba(26, 111, 232, .18)
}

.btn-del {
    background: rgba(239, 68, 68, .08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, .18);
    padding: 7px 9px;
    border-radius: var(--rsm);
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    transition: background .12s;
    display: flex;
    align-items: center;
    justify-content: center
}

.btn-del:hover {
    background: rgba(239, 68, 68, .18)
}

/* ── Upload panel ── */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(26, 111, 232, .05)
}

.section-title {
    font-weight: 900;
    font-size: 15px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #0f1b33
}

.section-title i {
    color: var(--accent)
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 12px
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 160px
}

.form-group label {
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--rsm);
    padding: 9px 11px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    width: 100%
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 111, 232, .1)
}

.form-group textarea {
    resize: vertical;
    min-height: 80px
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: var(--rsm);
    font-weight: 900;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: filter .15s, transform .1s;
    flex-shrink: 0
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px)
}

.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none
}

.btn-ghost {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 9px 14px;
    border-radius: var(--rsm);
    font-weight: 800;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background .12s, color .12s;
    flex-shrink: 0
}

.btn-ghost:hover {
    color: var(--accent);
    border-color: var(--border2);
    background: var(--surface3)
}

.progress-wrap {
    margin-top: 10px
}

.progress-bar-bg {
    height: 8px;
    background: var(--surface3);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border)
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #5a96f0);
    border-radius: 99px;
    transition: width .25s
}

.progress-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 700
}

.upload-result {
    margin-top: 10px;
    padding: 10px 13px;
    border-radius: var(--rsm);
    font-size: 13px;
    font-weight: 700;
    display: none
}

.upload-result.ok {
    background: rgba(16, 185, 129, .1);
    border: 1px solid rgba(16, 185, 129, .22);
    color: #0d9668
}

.upload-result.err {
    background: rgba(239, 68, 68, .08);
    border: 1px solid rgba(239, 68, 68, .18);
    color: #dc2626
}

/* ── Modal (edit) ── */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 51, .45);
    backdrop-filter: blur(6px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.modal-bg.open {
    display: flex;
    animation: fadeIn .18s ease
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    width: min(640px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(15, 27, 51, .25)
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #0f1b33
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1
}

.modal-close:hover {
    color: var(--text)
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border)
}

.toggle-row:last-child {
    border-bottom: none
}

.toggle-row label {
    font-weight: 700;
    font-size: 13px
}

.toggle {
    position: relative;
    width: 38px;
    height: 22px;
    flex-shrink: 0
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--surface3);
    border-radius: 99px;
    cursor: pointer;
    transition: background .2s
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2)
}

.toggle input:checked+.toggle-slider {
    background: var(--accent)
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(16px)
}

/* ── Upload for specific asset inside edit modal ── */
.asset-upload-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

.asset-upload-row input[type=file] {
    flex: 1;
    min-width: 0;
    font-size: 12px
}

/* ── Changelog ── */
.commit-list {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.commit-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--rsm);
    padding: 12px 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start
}

.commit-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0
}

.commit-msg {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 3px;
    color: #0f1b33
}

.commit-meta {
    font-size: 11px;
    color: var(--muted)
}

.commit-sha {
    font-family: monospace;
    font-size: 11px;
    color: var(--accent);
    opacity: .8
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9000;
    padding: 13px 17px;
    border-radius: var(--rsm);
    font-weight: 900;
    font-size: 13px;
    color: #fff;
    display: none;
    max-width: 340px;
    box-shadow: 0 4px 24px rgba(15, 27, 51, .25);
    animation: slideUp .2s ease
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ── Loading overlay ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(240, 244, 255, .85);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    flex-direction: column;
    gap: 12px
}

.loading-overlay.on {
    display: flex
}

.spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(26, 111, 232, .12);
    border-top-color: var(--accent);
    animation: spin .7s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.loading-text {
    color: var(--accent);
    font-weight: 900;
    font-size: 13px
}

/* ── Stats cards ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    padding: 16px;
    box-shadow: 0 2px 10px rgba(26, 111, 232, .05)
}

.stat-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 6px
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
    color: #0f1b33
}

.stat-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px
}

.dashboard-guide-section {
    margin-top: 6px;
}

.dashboard-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.dashboard-guide-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    padding: 14px;
}

.dashboard-guide-card h3 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 900;
    color: #0f1b33;
    display: flex;
    align-items: center;
    gap: 7px;
}

.dashboard-guide-card h3 i {
    color: var(--accent);
}

.dashboard-guide-card ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 7px;
}

.dashboard-guide-card li {
    color: #41506f;
    font-size: 12.5px;
    line-height: 1.45;
}

.dashboard-legal-warning {
    margin-top: 10px;
    border: 2px solid #ef4444;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    box-shadow: 0 8px 22px rgba(239, 68, 68, .18);
}

.dashboard-legal-warning-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 900;
    color: #b91c1c;
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .25);
    border-radius: var(--rsm);
    padding: 8px 12px;
    margin-bottom: 12px;
    letter-spacing: .03em;
}

.dashboard-legal-warning-title i {
    color: #dc2626;
}

.dashboard-legal-warning p {
    color: #7f1d1d;
    font-size: 13px;
    line-height: 1.6;
    font-weight: 700;
    margin-bottom: 8px;
}

.dashboard-legal-warning p:last-child {
    margin-bottom: 0;
}

/* ── Empty / error states ── */
.state-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted)
}

.state-empty i {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: .45;
    display: block;
    color: var(--accent)
}

.state-empty p {
    font-weight: 700
}

/* ── Pending cards ── */
.pending-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px
}

.pending-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--rsm);
    background: var(--surface3);
    flex-shrink: 0;
    overflow: hidden
}

.pending-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.pending-info {
    flex: 1;
    min-width: 0
}

.pending-title {
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 3px;
    color: #0f1b33
}

.pending-meta {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px
}

.pending-actions {
    display: flex;
    gap: 6px
}

.btn-approve {
    background: rgba(16, 185, 129, .1);
    color: #0d9668;
    border: 1px solid rgba(16, 185, 129, .22);
    padding: 6px 11px;
    border-radius: var(--rsm);
    font-weight: 800;
    font-size: 12px;
    cursor: pointer
}

.btn-approve:hover {
    background: rgba(16, 185, 129, .2)
}

.btn-reject {
    background: rgba(239, 68, 68, .08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, .18);
    padding: 6px 11px;
    border-radius: var(--rsm);
    font-weight: 800;
    font-size: 12px;
    cursor: pointer
}

.btn-reject:hover {
    background: rgba(239, 68, 68, .18)
}

/* ── Upload step wizard ── */
.upload-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    box-shadow: 0 2px 10px rgba(26, 111, 232, .05)
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface3);
    border: 2px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    color: var(--muted);
    transition: background .2s, border-color .2s, color .2s
}

.step-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    transition: color .2s
}

.step.active .step-num {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff
}

.step.active .step-label {
    color: var(--accent)
}

.step.done .step-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff
}

.step.done .step-label {
    color: var(--success)
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border2);
    border-radius: 1px;
    margin: 0 10px;
    min-width: 20px
}

.upload-step-panel {
    display: none
}

.upload-step-panel.active {
    display: block;
    animation: fadeIn .2s ease
}

@media(max-width:700px) {
    .app {
        flex-direction: column
    }

    .sidebar {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        width: 100%;
        height: auto;
        top: var(--nav-h);
        padding: 10px 10px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        z-index: 160
    }

    .sb-label {
        margin-top: 0;
        margin-left: 6px;
        margin-right: 2px;
        padding: 0;
        flex-shrink: 0;
        font-size: 9px
    }

    .nav-item {
        width: auto;
        flex-shrink: 0;
        padding: 8px 10px;
        font-size: 12px
    }

    .nav-item i {
        width: 14px
    }

    .badge-count {
        margin-left: 6px
    }

    .main {
        padding: 16px
    }

    .mods-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr))
    }

    .upload-steps {
        flex-wrap: wrap;
        gap: 8px
    }

    .step-line {
        display: none
    }
}

.ticket-shell {
    display: grid;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ticket-list-panel,
.ticket-detail-card,
.ticket-detail-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(26, 111, 232, .05);
}

.ticket-list-head {
    display: grid;
    grid-template-columns: 82px 1fr 1.4fr 76px;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.ticket-list-body {
    display: flex;
    flex-direction: column;
    max-height: 72vh;
    overflow: auto;
}

.ticket-list-item {
    display: grid;
    grid-template-columns: 82px 1fr 1.4fr 76px;
    gap: 10px;
    align-items: center;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: background .12s ease, border-color .12s ease;
}

.ticket-list-item:hover {
    background: var(--surface2);
}

.ticket-list-item.active {
    background: rgba(26, 111, 232, .08);
    box-shadow: inset 3px 0 0 var(--accent);
}

.ticket-list-item:last-child {
    border-bottom: none;
}

.ticket-col {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-col.id {
    font-weight: 800;
    color: #15356f;
}

.ticket-col.name,
.ticket-col.subject {
    font-size: 13px;
}

.ticket-col.priority {
    font-size: 11px;
    font-weight: 800;
}

.ticket-detail-panel {
    min-height: 72vh;
    padding: 0;
}

.ticket-detail-card {
    padding: 18px;
}

.ticket-detail-empty {
    min-height: 72vh;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-align: center;
    gap: 8px;
}

.ticket-detail-empty i {
    font-size: 28px;
}

.ticket-detail-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.ticket-detail-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #0f1b33;
    margin-bottom: 6px;
}

.ticket-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    color: var(--muted);
    font-size: 12px;
}

.ticket-detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ticket-detail-meta a {
    color: var(--accent);
    text-decoration: none;
}

.ticket-detail-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-pill {
    display: inline-flex;
    align-items: center;
    background: var(--surface3);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
}

.ticket-description-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 14px;
}

.ticket-description-card strong {
    display: block;
    margin-bottom: 6px;
    color: #15356f;
}

.ticket-attachment-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.ticket-attachment-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ticket-attachment-links a {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--surface3);
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.ticket-thread-wrap {
    margin-bottom: 14px;
}

.ticket-thread-title {
    font-size: 13px;
    font-weight: 900;
    color: #15356f;
    margin-bottom: 8px;
}

.ticket-thread-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ticket-thread-empty {
    border: 1px dashed var(--border2);
    border-radius: var(--rmd);
    padding: 14px;
    font-size: 13px;
    color: var(--muted);
    background: var(--surface2);
}

.ticket-bubble {
    border-radius: var(--rmd);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.6;
    border-left: 3px solid transparent;
}

.ticket-bubble.customer {
    background: var(--surface2);
    border-left-color: var(--muted);
}

.ticket-bubble.staff {
    background: var(--surface3);
    border-left-color: var(--accent);
}

.ticket-bubble-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.ticket-bubble-head strong {
    color: #15356f;
}

.ticket-bubble-head span {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.ticket-bubble-body {
    white-space: normal;
}

.ticket-bubble-body p,
.ticket-description-card p {
    margin: 0 0 10px;
}

.ticket-bubble-body p:last-child,
.ticket-description-card p:last-child {
    margin-bottom: 0;
}

.ticket-reply-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--rmd);
    overflow: hidden;
}

.ticket-editor-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--surface3);
    flex-wrap: wrap;
}

.ticket-editor-input {
    min-height: 120px;
    max-height: 280px;
    overflow: auto;
    padding: 12px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    outline: none;
    white-space: pre-wrap;
    background: var(--surface);
}

.ticket-editor-input:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.ticket-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}

@media (max-width: 1180px) {
    .ticket-shell {
        grid-template-columns: 1fr;
    }

    .ticket-list-body,
    .ticket-detail-panel,
    .ticket-detail-empty {
        max-height: none;
        min-height: 0;
    }
}

@media (max-width: 760px) {
    .ticket-list-head,
    .ticket-list-item {
        grid-template-columns: 74px 1fr;
    }

    .ticket-list-head span:nth-child(3),
    .ticket-list-head span:nth-child(4),
    .ticket-list-item .ticket-col.subject,
    .ticket-list-item .ticket-col.priority {
        display: none;
    }

    .ticket-detail-top {
        flex-direction: column;
    }
}