:root {
    --bg: #f4f5fb;
    --bg-soft: #f8f9fd;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-strong: #ffffff;
    --panel-muted: #f3f5fb;
    --line: #e6eaf5;
    --line-strong: #d9dfef;
    --text: #23263b;
    --muted: #8a91a8;
    --muted-strong: #68708b;
    --blue: #4e7cf4;
    --blue-soft: #edf3ff;
    --green: #1dbf73;
    --green-soft: #eafaf2;
    --orange: #ffa51f;
    --orange-soft: #fff5e5;
    --coral: #ff7b57;
    --coral-soft: #fff0ec;
    --danger: #f35366;
    --danger-soft: #ffecef;
    --shadow-sm: 0 8px 18px rgba(31, 45, 91, 0.05);
    --shadow-md: 0 18px 45px rgba(31, 45, 91, 0.08);
    --shadow-lg: 0 28px 72px rgba(31, 45, 91, 0.12);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(78, 124, 244, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(29, 191, 115, 0.08), transparent 22%),
        linear-gradient(180deg, #f7f8fc 0%, #f1f3f9 100%);
    color: var(--text);
    font: 15px/1.55 "Manrope", "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
code {
    padding: 4px 9px;
    border-radius: 999px;
    background: #eff3fb;
    color: var(--blue);
    font-family: "Outfit", "Segoe UI", sans-serif;
    font-size: 12px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px 22px;
    background: rgba(255, 255, 255, 0.82);
    border-right: 1px solid rgba(225, 229, 240, 0.8);
    backdrop-filter: blur(18px);
}

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

.brand-stack {
    padding: 8px 10px 18px;
    margin-bottom: 10px;
}

.brand-logo {
    display: grid;
    grid-template-columns: repeat(2, 18px);
    gap: 4px;
    padding: 8px;
    border-radius: 18px;
    background: linear-gradient(145deg, #f7f8ff, #eef2ff);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.95), var(--shadow-sm);
}

.brand-logo span {
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 5px;
    transform: rotate(45deg);
    background: linear-gradient(135deg, #7190ff, #4769ec);
}

.brand-logo span:nth-child(2) { background: linear-gradient(135deg, #90a8ff, #5679f3); }
.brand-logo span:nth-child(3) { background: linear-gradient(135deg, #5e80f2, #3957d3); }
.brand-logo span:nth-child(4) { background: linear-gradient(135deg, #7f96ff, #4a67df); }

.brand strong {
    display: block;
    font: 800 22px/1 "Outfit", sans-serif;
    letter-spacing: .01em;
}

.brand small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav {
    display: grid;
    gap: 20px;
    padding: 12px 8px 0;
}

.nav-label {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.nav-links {
    display: grid;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 15px;
    color: var(--muted-strong);
    font-weight: 700;
    transition: .22s ease;
}

.nav-item:hover {
    background: rgba(78, 124, 244, 0.08);
    color: var(--blue);
}

.nav-item.active {
    background: linear-gradient(135deg, #edf3ff, #f6f8ff);
    color: var(--blue);
    box-shadow: inset 0 0 0 1px rgba(78, 124, 244, 0.08);
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #f4f6fd;
    color: inherit;
    font-size: 13px;
    flex: 0 0 auto;
}

.nav-item.active .nav-icon {
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.sidebar-footer {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 22px;
    display: grid;
    gap: 12px;
}

.mini-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fbff, #f1f6ff);
    border: 1px solid var(--line);
}

.mini-card strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
}

.mini-card small {
    color: var(--muted);
    font-size: 11px;
}

.mini-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1ccf7a, #10a95f);
    box-shadow: 0 0 0 6px rgba(29, 191, 115, 0.12);
}

.logout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 14px;
    background: #fff3f5;
    color: var(--danger);
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(243, 83, 102, 0.12);
}

.main {
    min-width: 0;
    padding: 18px 20px 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 6px 6px 22px;
}

.topbar-main {
    min-width: 0;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.crumb-home::before {
    content: "⌂";
    display: inline-block;
    margin-right: 8px;
    color: var(--blue);
}

.crumb-sep {
    color: #bcc3d7;
}

.crumb-current {
    color: var(--text);
}

.topbar p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.topbar h1 {
    margin: 0;
    font: 800 32px/1.05 "Outfit", sans-serif;
    letter-spacing: -.03em;
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.top-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(320px, 100%);
    min-height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.top-search input {
    border: 0;
    background: transparent;
    min-height: 0;
    padding: 0;
    box-shadow: none;
    font-size: 14px;
}

.top-search input:focus {
    box-shadow: none;
}

.search-icon {
    color: var(--muted);
    font-size: 16px;
}

.status-chip,
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

.status-chip {
    color: var(--muted-strong);
}

.status-chip strong,
.user-chip strong {
    color: var(--text);
    font-size: 13px;
}

.status-chip span,
.user-chip small {
    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffb11b;
}

.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #58d777, #21b862);
    color: #fff;
    font-weight: 800;
}

.content {
    display: grid;
    gap: 18px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat,
.panel,
.file-card {
    background: var(--panel);
    border: 1px solid rgba(229, 233, 243, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.stat {
    position: relative;
    overflow: hidden;
    padding: 22px 22px 20px;
}

.stat::after {
    content: "";
    position: absolute;
    inset: auto -26px -26px auto;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(78, 124, 244, 0.12), transparent 70%);
}

.stat-badge {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
}

.stat-badge.coral { background: var(--coral-soft); color: var(--coral); }
.stat-badge.blue { background: var(--blue-soft); color: var(--blue); }
.stat-badge.orange { background: var(--orange-soft); color: var(--orange); }
.stat-badge.green { background: var(--green-soft); color: var(--green); }

.stat strong {
    display: block;
    margin-bottom: 4px;
    font: 800 34px/1 "Outfit", sans-serif;
    letter-spacing: -.03em;
}

.stat strong.coral { color: var(--coral); }
.stat strong.blue { color: var(--blue); }
.stat strong.orange { color: var(--orange); }
.stat strong.green { color: var(--green); }

.stat span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-meta {
    display: block;
    margin-top: 12px;
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 700;
}

.panel {
    padding: 22px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0;
    font: 800 22px/1.1 "Outfit", sans-serif;
}

.panel-head p,
.hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.8fr .82fr;
    gap: 18px;
    align-items: stretch;
}

.sales-panel {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    min-height: 380px;
}

.sales-legend {
    display: grid;
    align-content: start;
    gap: 16px;
}

.legend-item {
    display: grid;
    gap: 4px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-dot.blue { background: #5e7dfa; }
.legend-dot.green { background: #23c276; }
.legend-dot.coral { background: #ff8a66; }
.legend-dot.orange { background: #ffb323; }

.legend-value {
    font: 800 26px/1 "Outfit", sans-serif;
}

.legend-note {
    color: var(--muted);
    font-size: 12px;
}

.view-link {
    margin-top: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: #eef1fb;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn.primary {
    background: linear-gradient(135deg, #4e7cf4, #6287f7);
    color: #fff;
}

.btn.danger {
    background: #fff1f3;
    color: var(--danger);
}

.btn.small {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 12px;
}

.sales-chart {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 14px;
}

.range-pills {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.range-pill {
    padding: 7px 12px;
    border-radius: 999px;
    background: #f5f6fb;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.range-pill.active {
    background: #28c66f;
    color: #fff;
}

.chart-shell {
    position: relative;
    min-height: 250px;
    border-radius: 22px;
    background:
        linear-gradient(to top, rgba(78, 124, 244, 0.05), rgba(78, 124, 244, 0)),
        repeating-linear-gradient(to right, transparent 0, transparent 48px, rgba(230, 234, 245, 0.8) 48px, rgba(230, 234, 245, 0.8) 49px),
        repeating-linear-gradient(to bottom, transparent 0, transparent 52px, rgba(235, 238, 246, 0.9) 52px, rgba(235, 238, 246, 0.9) 53px),
        #fbfcff;
    overflow: hidden;
}

.chart-shell svg {
    position: absolute;
    inset: 16px 12px 26px;
    width: calc(100% - 24px);
    height: calc(100% - 42px);
}

.chart-months {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.chart-months span { text-align: center; }

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.sales-side {
    display: grid;
    align-content: start;
    gap: 18px;
}

.mini-chart {
    display: grid;
    gap: 20px;
    min-height: 380px;
}

.mini-bars {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    min-height: 170px;
    padding: 12px 10px 0;
}

.bar-col {
    flex: 1 1 0;
    display: grid;
    gap: 10px;
    justify-items: center;
}

.bar {
    width: 26px;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(180deg, #6b85f7, #466be8);
}

.bar-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.mini-score {
    font: 800 48px/1 "Outfit", sans-serif;
    text-align: center;
}

.mini-sub {
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.dual-panels {
    display: grid;
    grid-template-columns: 1.2fr .9fr;
    gap: 18px;
}

.stats-list {
    display: grid;
    gap: 12px;
}

.list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--panel-muted);
}

.list-card strong {
    display: block;
    font-size: 14px;
    font-weight: 800;
}

.list-card span {
    color: var(--muted);
    font-size: 12px;
}

.list-chip {
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    font: 800 20px/1 "Outfit", sans-serif;
}

.quick-links {
    display: grid;
    gap: 12px;
}

.quick-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #fbfcff, #f4f7ff);
    border: 1px solid var(--line);
    font-weight: 800;
}

.quick-link small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.table-wrap {
    overflow: auto;
    border-radius: 20px;
    border: 1px solid var(--line);
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: var(--panel-strong);
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid #eef1f7;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: #fafbff;
}

tr:hover td {
    background: #fcfdff;
}

tr:last-child td {
    border-bottom: 0;
}

.game-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
}

.game-cell img,
.thumb {
    width: 52px;
    height: 62px;
    object-fit: cover;
    border-radius: 14px;
    background: #eef2fb;
}

.thumb {
    width: 96px;
    height: 54px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef6ff;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
}

.filters,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.filters {
    grid-template-columns: minmax(180px, 1fr) 220px auto;
    margin-bottom: 18px;
}

.analytics-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-grid {
    grid-template-columns: 1.55fr .85fr;
}

.analytics-bottom-grid {
    grid-template-columns: 1.35fr .75fr;
}

.analytics-filter-bar {
    padding: 18px 20px;
}

.analytics-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.25fr) repeat(2, minmax(180px, .72fr)) repeat(2, minmax(150px, .62fr)) auto;
    gap: 14px;
    align-items: end;
}

.analytics-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.is-disabled {
    opacity: .55;
}

.analytics-panel-head {
    margin-bottom: 0;
}

.analytics-subhead {
    margin-top: 24px;
}

.analytics-trend-panel {
    grid-template-columns: 240px minmax(0, 1fr);
}

.analytics-trend-shell {
    display: grid;
    gap: 16px;
}

.analytics-bars {
    display: flex;
    align-items: end;
    gap: 14px;
    min-height: 320px;
    padding: 12px 4px 0;
    overflow-x: auto;
}

.analytics-bar-group {
    min-width: 64px;
    display: grid;
    gap: 10px;
    justify-items: center;
}

.analytics-bar-stack {
    height: 220px;
    width: 100%;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 8px;
    padding: 0 8px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.8), rgba(247,249,255,.95)),
        repeating-linear-gradient(to top, transparent 0, transparent 39px, rgba(230,234,245,.8) 39px, rgba(230,234,245,.8) 40px);
    border: 1px solid var(--line);
}

.analytics-bar {
    width: 16px;
    min-height: 10px;
    border-radius: 999px 999px 6px 6px;
}

.analytics-bar.views {
    background: linear-gradient(180deg, #ff9b7c, #ff7b57);
}

.analytics-bar.downloads {
    background: linear-gradient(180deg, #6d8cff, #4972f1);
}

.analytics-bar-values,
.analytics-bar-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.analytics-side-panel {
    display: grid;
    align-content: start;
    gap: 18px;
}

.analytics-mix-list,
.analytics-top-games {
    display: grid;
    gap: 14px;
}

.analytics-mix-item {
    display: grid;
    gap: 8px;
}

.analytics-mix-head,
.analytics-top-game {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.analytics-mix-head strong,
.analytics-top-game strong {
    font-size: 14px;
}

.analytics-top-game span {
    color: var(--muted);
    font-size: 12px;
}

.analytics-progress {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #eef1fb;
    overflow: hidden;
}

.analytics-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5a83ff, #2fc486);
}

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

.analytics-empty strong {
    color: var(--text);
    font: 800 20px/1.1 "Outfit", sans-serif;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #bcd0ff;
    box-shadow: 0 0 0 4px rgba(78, 124, 244, 0.08);
}

textarea {
    min-height: 130px;
    resize: vertical;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check input {
    width: auto;
    min-height: 0;
}

.span-2 {
    grid-column: 1 / -1;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.file-card {
    padding: 16px 18px;
}

.file-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.file-card span {
    color: var(--muted);
    font-size: 12px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions form {
    margin: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination a {
    min-width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255,255,255,.85);
    font-weight: 800;
}

.pagination a.active {
    background: var(--blue);
    color: #fff;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.alert.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.alert.warning {
    background: var(--orange-soft);
    color: var(--orange);
}

.alert.info {
    background: var(--blue-soft);
    color: var(--blue);
}

.login-page {
    display: grid;
    place-items: center;
}

.login-card {
    box-shadow: var(--shadow-lg);
}

.import-log {
    padding: 28px;
}

.log-box {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255,255,255,.95);
    box-shadow: var(--shadow-md);
}

@media (max-width: 1180px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .dual-panels,
    .sales-panel {
        grid-template-columns: 1fr;
    }

    .analytics-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-footer {
        position: static;
        margin-top: 18px;
    }

    .main {
        padding: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-tools {
        justify-content: stretch;
    }

    .top-search,
    .status-chip,
    .user-chip {
        width: 100%;
    }

    .filters,
    .form-grid,
    .cards {
        grid-template-columns: 1fr;
    }

    .analytics-filter-form {
        grid-template-columns: 1fr;
    }

    .analytics-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
