:root {
    --bg: #10120f;
    --bg-soft: #171a15;
    --panel: #1d211a;
    --panel-strong: #242a20;
    --line: #343c2c;
    --line-strong: #4e5c3d;
    --text: #f5f2e8;
    --muted: #b8b39f;
    --quiet: #817d6e;
    --gold: #f4c84a;
    --gold-strong: #d99c19;
    --green: #20c77a;
    --green-dark: #0f8a55;
    --red: #ef6a57;
    --violet: #9b7cf7;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
    --radius: 8px;
    --font: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --heading: "Space Grotesk", var(--font);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(135deg, rgba(32, 199, 122, 0.08), transparent 34rem),
        linear-gradient(180deg, #10120f 0%, #151811 100%);
    color: var(--text);
    font-family: var(--font);
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 18, 15, 0.92);
    backdrop-filter: blur(16px);
}

.topbar__inner,
.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar__inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

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

.brand__mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--gold), var(--green));
    color: #13150f;
    box-shadow: var(--shadow);
}

.brand h1,
.brand p,
.panel-title h2,
.panel-title p,
.panel-header h2,
.chat-header h2,
.chat-header p,
.footer p {
    margin: 0;
}

.brand h1,
.panel-title h2,
.panel-header h2,
.chat-header h2 {
    font-family: var(--heading);
}

.brand h1 {
    font-size: 1.35rem;
}

.brand p,
.panel-title p,
.chat-header p {
    color: var(--muted);
    font-size: 0.82rem;
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid var(--line);
    background: rgba(29, 33, 26, 0.86);
    border-radius: var(--radius);
}

.profile__avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--green);
    color: #10120f;
    font-weight: 800;
}

.profile__meta {
    display: grid;
    gap: 2px;
}

.profile__meta strong {
    font-size: 0.84rem;
}

.profile__meta span {
    color: var(--muted);
    font-size: 0.74rem;
}

.shell {
    padding: 28px 0 36px;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 20px;
    align-items: start;
}

.auth-panel,
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(29, 33, 26, 0.92);
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 24px;
}

.auth-panel--primary {
    background:
        linear-gradient(145deg, rgba(244, 200, 74, 0.08), transparent 55%),
        rgba(29, 33, 26, 0.94);
}

.panel {
    padding: 20px;
}

.panel-title,
.panel-header,
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-title {
    margin-bottom: 18px;
}

.panel-title > i,
.chat-header__icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    color: var(--gold);
    background: var(--panel-strong);
}

.panel-title h2,
.panel-header h2,
.chat-header h2 {
    font-size: 1.05rem;
}

.form {
    display: grid;
    gap: 14px;
}

.form--compact {
    gap: 10px;
    margin-top: 12px;
}

.form--inline,
.search-form {
    grid-template-columns: minmax(220px, 1.4fr) minmax(100px, 0.55fr) minmax(110px, 0.55fr) auto;
    align-items: end;
}

.search-form {
    grid-template-columns: minmax(220px, 1.4fr) minmax(110px, 0.6fr) minmax(100px, 0.5fr) minmax(160px, 1fr) auto;
}

.form__row {
    display: grid;
    grid-template-columns: 1fr 118px;
    gap: 12px;
}

label {
    display: grid;
    gap: 7px;
}

label span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.checkbox-field {
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
}

.checkbox-field input {
    width: 18px;
    min-height: 18px;
    margin-top: 1px;
}

.checkbox-field span {
    text-transform: none;
    color: var(--muted);
    line-height: 1.4;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #11140f;
    color: var(--text);
    outline: 0;
    padding: 0 12px;
    font-size: 0.9rem;
}

input:focus,
select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(244, 200, 74, 0.15);
}

.button,
.icon-button,
.tab {
    border: 0;
    border-radius: var(--radius);
    min-height: 40px;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
}

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

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.button--primary {
    background: linear-gradient(135deg, var(--gold), var(--green));
    color: #10120f;
}

.button--secondary {
    background: var(--panel-strong);
    color: var(--text);
    border: 1px solid var(--line-strong);
}

.icon-button {
    width: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #141710;
    color: var(--muted);
}

.analysis-card {
    margin-top: 20px;
    padding: 14px;
    border: 1px solid rgba(32, 199, 122, 0.28);
    background: rgba(32, 199, 122, 0.08);
    border-radius: var(--radius);
}

.recover-box {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
}

.recover-box summary {
    cursor: pointer;
    color: var(--gold);
    font-size: 0.86rem;
    font-weight: 800;
}

.analysis-card strong {
    display: block;
    margin-bottom: 4px;
    color: var(--green);
}

.analysis-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: rgba(29, 33, 26, 0.72);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.tab.is-active {
    background: var(--gold);
    color: #11140f;
    border-color: var(--gold);
}

.badge {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 0.7rem;
}

.workspace__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}

.workspace__main,
.workspace__aside {
    display: grid;
    gap: 18px;
}

.panel-header {
    justify-content: space-between;
    margin-bottom: 16px;
}

.counter {
    color: var(--gold);
    font-size: 0.84rem;
    font-weight: 800;
}

.empty-state {
    min-height: 148px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--quiet);
    text-align: center;
}

.empty-state i {
    font-size: 1.65rem;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
}

.sticker-card {
    position: relative;
    min-height: 128px;
    display: grid;
    gap: 10px;
    align-content: space-between;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
}

.sticker-card__qty {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 30px;
    min-height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--gold);
    color: #10120f;
    font-size: 0.78rem;
    font-weight: 900;
}

.sticker-card small {
    display: block;
    max-width: 86px;
    color: var(--quiet);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sticker-card strong {
    display: block;
    margin-top: 8px;
    font-family: var(--heading);
    font-size: 1.5rem;
}

.sticker-card button,
.link-button {
    border: 0;
    background: transparent;
    color: var(--red);
    padding: 0;
    font-weight: 800;
    text-align: left;
}

.sticker-card--desired {
    border-color: rgba(244, 200, 74, 0.38);
}

.result-list,
.trade-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.collector-card,
.trade-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
}

.collector-card h3,
.trade-card h3 {
    margin: 0 0 4px;
    font-size: 0.94rem;
}

.collector-card p,
.trade-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.trade-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.84rem;
}

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

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
}

.admin-card h3,
.admin-card p {
    margin: 0;
}

.admin-card h3 {
    font-size: 0.96rem;
}

.admin-card p {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.admin-select {
    width: auto;
    min-width: 150px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--green);
    font-size: 0.76rem;
    font-weight: 800;
}

.status--pending {
    color: var(--gold);
}

.status--closed {
    color: var(--red);
}

.trade-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.2fr);
    gap: 18px;
}

.chat-panel {
    min-height: 520px;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.chat-header {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.chat-messages {
    min-height: 330px;
    max-height: 430px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 4px;
}

.message {
    max-width: min(76%, 420px);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
    color: var(--text);
}

.message--me {
    align-self: flex-end;
    border-color: transparent;
    background: var(--gold);
    color: #10120f;
}

.message--system {
    align-self: center;
    max-width: 92%;
    color: var(--muted);
    background: transparent;
    border-style: dashed;
}

.message strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    opacity: 0.74;
}

.message p {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.formula-box {
    min-height: 104px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #11140f;
    color: var(--gold);
    overflow-x: auto;
}

.formula-box math {
    font-size: 1.05rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.stat-grid div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
}

.stat-grid strong,
.stat-grid span {
    display: block;
}

.stat-grid strong {
    color: var(--text);
    font-size: 1.35rem;
}

.stat-grid span {
    color: var(--quiet);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.seed-list {
    display: grid;
    gap: 8px;
}

.seed-list span {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #12150f;
    color: var(--muted);
    font-size: 0.86rem;
}

.toast-container {
    position: fixed;
    top: 88px;
    right: 16px;
    z-index: 50;
    width: min(360px, calc(100vw - 32px));
    display: grid;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #1d211a;
    color: var(--text);
    box-shadow: var(--shadow);
}

.toast i {
    margin-top: 2px;
    color: var(--green);
}

.toast--error i {
    color: var(--red);
}

.toast--warning i {
    color: var(--gold);
}

.footer {
    padding: 20px;
    border-top: 1px solid var(--line);
    color: var(--quiet);
    text-align: center;
}

@media (max-width: 980px) {
    .auth-grid,
    .workspace__grid,
    .trade-layout,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .workspace__aside {
        order: -1;
    }
}

@media (max-width: 760px) {
    .topbar__inner,
    .shell {
        width: min(100% - 24px, 1180px);
    }

    .topbar__inner {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 0;
    }

    .profile {
        width: 100%;
        justify-content: space-between;
    }

    .form--inline,
    .search-form,
    .form__row,
    .chat-form {
        grid-template-columns: 1fr;
    }

    .tabs {
        display: grid;
    }

    .tab {
        justify-content: center;
    }

    .collector-card,
    .trade-card {
        align-items: stretch;
        flex-direction: column;
    }

    .button,
    .collector-card .button,
    .trade-card .button,
    .trade-actions .button {
        width: 100%;
    }

    .pagination-bar {
        flex-direction: column;
    }
}
