:root {
    --bg: #101112;
    --surface: #171819;
    --surface-2: #1d1e20;
    --card: #1b1c1e;
    --card-soft: #202123;
    --line: #2d2f32;
    --line-strong: #3b3d41;
    --text: #f0f0f0;
    --muted: #96989c;
    --muted-2: #707276;
    --accent: #f0782b;
    --accent-strong: #ff8b3d;
    --accent-soft: rgba(240, 120, 43, .13);
    --accent-line: rgba(240, 120, 43, .28);
    --ok: #8dc09c;
    --bad: #d58787;
    --shadow: none;
}

html[data-theme="light"] {
    --bg: #f4f4f3;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --card: #ffffff;
    --card-soft: #f8f8f7;
    --line: #e5e5e3;
    --line-strong: #d4d4d1;
    --text: #171717;
    --muted: #787878;
    --muted-2: #9a9a98;
    --accent: #e86f24;
    --accent-strong: #d96018;
    --accent-soft: #fff1e7;
    --accent-line: #f3c7a9;
    --ok: #358452;
    --bad: #b94c4c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    transition: background-color .18s ease, color .18s ease;
}

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

button,
input,
select {
    font: inherit;
}

button,
.button,
.nav-link,
input,
select,
.text-link,
.overview-card,
.small-stats article {
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, opacity .16s ease;
}

svg {
    display: block;
}

.page-enter {
    animation: page-enter .2s ease both;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

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

.public-theme {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
}

.icon-button,
.sidebar-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 9px;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
}

.icon-button:hover,
.sidebar-close:hover {
    border-color: var(--accent-line);
    color: var(--accent);
}

.icon-button svg,
.sidebar-close svg,
.theme-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.access {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
}

.access-card {
    width: min(430px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.form-card {
    width: min(470px, 100%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
}

.brand-box {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 8px;
    font-weight: 800;
}

.public-brand {
    margin-bottom: 32px;
}

.access-copy {
    margin-bottom: 24px;
}

.access-copy h1,
.page-head h1 {
    margin: 0 0 8px;
    letter-spacing: -.035em;
}

.access-copy h1 {
    font-size: 2rem;
}

.access-copy p,
.page-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.access-actions,
.form {
    display: grid;
    gap: 11px;
}

.button {
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(1px);
}

.button-main {
    background: var(--accent);
    color: #ffffff;
}

.button-main:hover {
    background: var(--accent-strong);
}

.button-secondary,
.button-quiet,
.button-small {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--line-strong);
}

.button-secondary:hover,
.button-quiet:hover,
.button-small:hover {
    border-color: var(--accent-line);
}

.button-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: .8rem;
}

.full {
    width: 100%;
}

.form label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: .82rem;
    font-weight: 650;
}

.form input,
.permission-form select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
}

.form input:focus,
.permission-form select:focus {
    border-color: var(--accent);
}

.switch {
    margin: 21px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: .84rem;
}

.switch a {
    color: var(--accent);
    font-weight: 700;
}

.mobile-bar {
    display: none;
}

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    min-height: 100vh;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 40;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .brand {
    padding: 0 8px 20px;
}

.sidebar-close {
    display: none;
}

.nav {
    flex: 1;
    display: grid;
    align-content: start;
    gap: 2px;
}

.nav-group {
    margin-bottom: 6px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 9px;
    overflow: hidden;
}

.nav-toggle {
    width: 100%;
    min-height: 39px;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 700;
}

.nav-toggle:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .16s ease;
    flex: 0 0 auto;
}

.nav-group.open .nav-toggle svg {
    transform: rotate(90deg);
}

.nav-children {
    display: none;
    padding: 0 6px 7px;
    border-top: 1px solid var(--line);
}

.nav-group.open .nav-children {
    display: block;
}

.nav-link {
    min-height: 35px;
    padding: 8px 10px 8px 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: .81rem;
}

.nav-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateX(2px);
}

.account {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 16px;
}

.theme-row {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--muted);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    margin-bottom: 12px;
}

.theme-row:hover {
    color: var(--accent);
    border-color: var(--accent-line);
}

.theme-icon {
    display: grid;
    place-items: center;
}

.account-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 4px 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.account-row strong,
.account-row small {
    display: block;
}

.account-row strong {
    font-size: .86rem;
}

.account-row small {
    color: var(--muted);
    font-size: .72rem;
    margin-top: 2px;
}

.sidebar-backdrop {
    display: none;
}

.content {
    width: 100%;
    max-width: 1600px;
    padding: 36px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.page-head h1 {
    font-size: 2rem;
}

.back-link {
    display: inline-block;
    color: var(--muted);
    font-size: .8rem;
    margin-bottom: 12px;
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    border-radius: 999px;
    color: var(--accent);
    font-size: .74rem;
    font-weight: 700;
}

.tag-small {
    min-height: 24px;
    padding: 4px 8px;
    font-size: .68rem;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.overview-card {
    min-height: 190px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.overview-card:hover {
    border-color: var(--accent-line);
    transform: translateY(-2px);
}

.metric-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 24px;
}

.metric-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.metric-icon.metric-text {
    font-weight: 800;
    font-size: 1.05rem;
}

.metric-label {
    display: block;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.overview-card strong {
    display: block;
    font-size: 2.05rem;
    letter-spacing: -.04em;
    margin-top: 10px;
}

.overview-card small {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    margin-top: 9px;
}

.small-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.small-stats article {
    min-height: 96px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 10px;
    padding: 14px;
}

.small-stats article:hover {
    border-color: var(--accent-line);
}

.small-stats span,
.small-stats small {
    display: block;
    color: var(--muted);
    font-size: .72rem;
}

.small-stats strong {
    display: block;
    font-size: 1.35rem;
    margin: 5px 0 2px;
}

.panel,
.points-card {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 11px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-title {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-size: .83rem;
    font-weight: 700;
}

.recent-panel {
    margin-top: 4px;
}

.activity-list {
    padding: 6px 16px;
}

.activity-item {
    min-height: 58px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-item strong,
.activity-item small {
    display: block;
}

.activity-item strong {
    font-size: .8rem;
    font-weight: 700;
}

.activity-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .7rem;
}

.activity-item time {
    color: var(--muted-2);
    font-size: .68rem;
    white-space: nowrap;
}

.empty,
.empty-section {
    color: var(--muted);
    font-size: .82rem;
}

.empty {
    padding: 18px 0;
}

.empty-section {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    gap: 6px;
    padding: 24px;
}

.empty-section strong {
    color: var(--text);
    font-size: 1rem;
}

.points-card {
    margin-bottom: 14px;
    padding: 20px;
    border-top: 3px solid var(--accent);
}

.points-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.points-top span {
    display: block;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.points-top strong {
    display: block;
    font-size: 2.25rem;
    letter-spacing: -.04em;
    margin-top: 4px;
}

.points-top small {
    color: var(--muted);
    font-size: .78rem;
    text-align: right;
}

.points-track {
    height: 9px;
    background: var(--card-soft);
    border-radius: 999px;
    overflow: hidden;
}

.points-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .35s ease;
}

.points-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 7px;
    color: var(--muted-2);
    font-size: .68rem;
}

.info-list {
    margin: 0;
    padding: 12px 16px;
}

.info-list div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.info-list div:last-child {
    border-bottom: 0;
}

.info-list dt {
    color: var(--muted);
}

.info-list dd {
    margin: 0;
    text-align: right;
}

.permission-form {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.table-panel {
    overflow: hidden;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

th,
td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted-2);
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

td {
    color: var(--text);
    font-size: .82rem;
}

td strong,
td small {
    display: block;
}

td small {
    margin-top: 2px;
    color: var(--muted-2);
}

.text-link {
    color: var(--accent);
    font-weight: 700;
    font-size: .78rem;
}

.state {
    font-size: .74rem;
    font-weight: 700;
}

.state.ok {
    color: var(--ok);
}

.state.bad {
    color: var(--bad);
}

.notice {
    margin-bottom: 14px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 8px;
    color: var(--text);
    font-size: .84rem;
    transition: opacity .18s ease, transform .18s ease;
}

.notice.success {
    border-color: rgba(90, 150, 105, .38);
    color: var(--ok);
}

.notice.error {
    border-color: rgba(180, 80, 80, .38);
    color: var(--bad);
}

.notice.floating {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    width: min(430px, calc(100% - 32px));
}

.error-card,
.error-page {
    text-align: center;
}

.error-code {
    margin: 0 0 8px;
    color: var(--muted-2);
    font-size: 3rem;
    font-weight: 750;
}

.error-card h1,
.error-page h1 {
    margin: 0 0 8px;
}

.error-card p,
.error-page p {
    color: var(--muted);
}

.error-page {
    min-height: 65vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
}

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

@media (max-width: 900px) {
    body.menu-open {
        overflow: hidden;
    }

    .mobile-bar {
        height: 62px;
        padding: 10px 14px;
        border-bottom: 1px solid var(--line);
        background: var(--surface);
        display: grid;
        grid-template-columns: 42px 1fr 42px;
        align-items: center;
        position: sticky;
        top: 0;
        z-index: 35;
    }

    .mobile-brand {
        text-align: center;
        font-weight: 750;
    }

    .layout {
        display: block;
        min-height: calc(100vh - 62px);
    }

    .sidebar {
        width: min(290px, 86vw);
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh;
        min-height: 0;
        transform: translateX(-102%);
        transition: transform .2s ease;
        box-shadow: none;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        display: grid;
        margin-bottom: 18px;
    }

    .sidebar .brand {
        padding-bottom: 18px;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: min(290px, 86vw);
        background: transparent;
        z-index: 38;
    }

    body.menu-open .sidebar-backdrop {
        display: block;
    }

    .content {
        padding: 24px 16px 34px;
    }

    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .overview-card {
        min-height: 172px;
        padding: 16px;
        border-radius: 14px;
    }

    .metric-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 20px;
    }

    .overview-card strong {
        font-size: 1.85rem;
    }

    .small-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-small-stats article:last-child {
        grid-column: 1 / -1;
    }

    .page-head h1 {
        font-size: 1.7rem;
    }
}

@media (max-width: 520px) {
    .page-head {
        flex-direction: column;
        gap: 10px;
    }

    .overview-card {
        min-height: 166px;
        padding: 15px;
    }

    .metric-label {
        font-size: .66rem;
    }

    .overview-card strong {
        font-size: 1.7rem;
    }

    .overview-card small {
        font-size: .7rem;
    }

    .small-stats {
        grid-template-columns: 1fr 1fr;
    }

    .points-top {
        display: grid;
        gap: 8px;
    }

    .points-top small {
        text-align: left;
    }
}

.profile-grid {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 14px;
}

.profile-main {
    min-height: 210px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-main h2 {
    margin: 0 0 6px;
    font-size: 1.5rem;
}

.profile-main p {
    margin: 0;
    color: var(--muted);
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 800;
}

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

a.overview-card {
    color: inherit;
    text-decoration: none;
    display: block;
}

.nav-section + .nav-link {
    margin-top: 1px;
}

@media (max-width: 900px) {
    .sidebar,
    .sidebar * {
        touch-action: manipulation;
    }

    .nav-toggle {
        position: relative;
        z-index: 2;
    }
}
