/* Общий стиль сайта */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #000 100%);
    color: #e5e7eb;
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* Шапка и подвал */
.site-header,
.site-footer {
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(14px);
}

.site-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    border-bottom: 0;
    padding: 12px 0;
}

.header-row,
.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav {
    display: flex;
    gap: 12px;
}

.nav-link {
    text-decoration: none;
    color: #cbd5f5;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #ffffff;
}

.muted {
    opacity: 0.7;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.1s ease, transform 0.05s ease, box-shadow 0.1s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #f9fafb;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

/* Страница аккаунта */
.account-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.account-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px 16px;
    align-items: flex-start;
}

.account-title {
    margin: 0;
    font-size: 26px;
    letter-spacing: -0.02em;
}

.account-subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    color: #9ca3af;
}

.account-status {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.2);
    border: 1px solid rgba(34, 197, 194, 0.35);
    color: #a5f3fc;
    font-size: 13px;
    white-space: nowrap;
}

.account-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 18px;
}

.account-layout.overview-layout {
    align-items: start;
    gap: 32px;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.panel-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.panel-layout > .account-card {
    width: min(1140px, 100%);
}

.account-layout.market-layout {
    grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1100px) {
    .account-layout.overview-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .account-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.account-card {
    background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.25), rgba(15, 23, 42, 0.9));
    border-radius: 18px;
    padding: 32px 24px 28px;
    min-height: 200px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(15, 23, 42, 0.3);
}

.account-card h2,
.account-card h3 {
    margin: 0 0 10px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e5e7eb;
}

.account-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: #9ca3af;
}

.account-hint--warning {
    color: #fbbf24;
}

.overview-table {
    margin-top: 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;
    overflow: hidden;
}

.overview-table__head,
.overview-table__row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(120px, 1fr));
    gap: 12px;
    padding: 14px 18px;
}

.overview-table__head {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(15, 23, 42, 0.9);
    color: #d1d5db;
}

.overview-table__row {
    background: rgba(15, 23, 42, 0.7);
    align-items: center;
    font-size: 13px;
}

.overview-table__row:not(:last-child) {
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.overview-skin-name {
    font-weight: 600;
    color: #e5e7eb;
}

.overview-skin-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #94a3b8;
}

.overview-empty {
    padding: 16px;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    background: rgba(15, 23, 42, 0.75);
}

@media (max-width: 640px) {
    .overview-table__head,
    .overview-table__row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .overview-table__head,
    .overview-table__row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        row-gap: 10px;
    }
    .overview-table__head span:nth-child(n + 3),
    .overview-table__row > div:nth-child(n + 3) {
        border-top: 1px solid rgba(148, 163, 184, 0.15);
        padding-top: 6px;
    }
}

.balance-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0 14px;
}

.balance-item {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.balance-item-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 3px;
}

.balance-item-value {
    display: block;
    font-size: 20px;
    font-weight: 600;
}

.balance-item-value.muted {
    font-size: 16px;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* DEBUG блок */
.account-debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.badge-soft {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #7dd3fc;
}

.debug-output {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.4;
    max-height: 260px;
    overflow: auto;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px dashed rgba(148, 163, 184, 0.6);
    color: #e5e7eb;
}

/* Маркет */
.market-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.market-filters {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    align-items: end;
}

.market-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.market-filter-field span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.market-filter-field input {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    font-size: 14px;
}

.market-pagination {
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.market-pagination--top {
    margin-top: 10px;
}

.market-pagination--bottom {
    margin-top: 18px;
    margin-bottom: 0;
}

.pagination-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: #e5e7eb;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease, color 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 13px;
    color: #cbd5f5;
}

.market-lazy-sentinel {
    height: 1px;
    width: 100%;
}

.market-card {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.35);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.market-card-header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.market-card-thumb {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.market-card-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.market-card-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.market-card--inactive {
    border-color: rgba(248, 113, 113, 0.8);
    background: rgba(127, 29, 29, 0.25);
}

.market-card--inactive .market-card-price {
    color: #fecdd3;
}

.market-card-title {
    font-size: 13px;
    font-weight: 500;
}

.market-card-secondary {
    font-size: 11px;
    color: #9ca3af;
}

.market-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.market-card-price {
    font-size: 15px;
    font-weight: 600;
    color: #bbf7d0;
}

.market-card-unlock {
    font-size: 11px;
    color: #a5b4fc;
}

.market-card-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: -2px;
}

.market-trade-form {
    margin: 16px 0 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    align-items: end;
}

.market-trade-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.market-trade-field label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.market-trade-field input {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 8px 10px;
    font-size: 14px;
    background: rgba(15, 23, 42, 0.7);
    color: #e5e7eb;
}

.market-trade-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #cbd5f5;
}

.market-trade-save {
    justify-self: start;
}

.market-trade-status {
    min-height: 18px;
    color: #a5b4fc;
}

.market-trade-status.error {
    color: #fecaca;
}

.market-trade-status.success {
    color: #bbf7d0;
}

.market-card-buy {
    margin-top: 4px;
}

.market-buy-btn {
    width: 100%;
    border: 1px solid rgba(59, 130, 246, 0.8);
    border-radius: 10px;
    padding: 6px 10px;
    background: rgba(37, 99, 235, 0.15);
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.market-buy-btn:hover {
    background: rgba(37, 99, 235, 0.25);
    color: #e0f2fe;
}

.market-buy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Блок автопокупки */
.autobuy-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.autobuy-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.autobuy-field input {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.75);
    color: #f1f5f9;
    font-size: 14px;
}

.autobuy-field input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
}

.autobuy-hint {
    font-size: 12px;
    color: #9ca3af;
}

.autobuy-credentials {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.autobuy-credentials-form {
    margin-top: 12px;
    display: grid;
    gap: 12px;
}

.autobuy-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.autobuy-save {
    justify-self: start;
    margin-top: 4px;
}

.btn.btn-secondary {
    background: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.btn.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.3);
    transform: translateY(-1px);
}

.autobuy-status {
    min-height: 16px;
    font-size: 13px;
    color: #a5f3fc;
    margin-top: 14px;
}

.autobuy-status.error {
    color: #fecaca;
}

.autobuy-run-status {
    margin-top: 18px;
    min-height: 18px;
    font-size: 13px;
    color: #c7d2fe;
}

.autobuy-run-status.error {
    color: #fecaca;
}

.positions-empty {
    margin-top: 18px;
    font-size: 13px;
    color: #94a3b8;
}

.panel-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.panel-headline p {
    margin: 0.25rem 0 0;
}

.positions-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.positions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.positions-list {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    width: 100%;
}

.positions-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: #94a3b8;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-button {
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: border 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.pagination-button:hover:not(:disabled) {
    border-color: rgba(34, 197, 94, 0.6);
    color: #bbf7d0;
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.position-card {
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 16px;
    padding: 16px 18px;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.6);
}

.position-card--disabled {
    border-color: rgba(248, 113, 113, 0.6);
    opacity: 0.75;
}

.position-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.position-card-label {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.position-card-header h3 {
    margin: 2px 0 0;
    font-size: 18px;
    color: #f1f5f9;
}

.position-toggle,
.position-delete {
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    background: transparent;
    color: #e5e7eb;
    font-size: 12px;
    padding: 6px 14px;
    cursor: pointer;
    transition: border 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.position-toggle:hover {
    border-color: rgba(34, 197, 94, 0.6);
    color: #bbf7d0;
}

.position-delete {
    border-color: rgba(248, 113, 113, 0.8);
    color: #fecdd3;
}

.position-delete:hover {
    background: rgba(127, 29, 29, 0.3);
}

.position-card-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 0;
}

.position-card-meta dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 2px;
}

.position-card-meta dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #f8fafc;
}

.position-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
}

.position-created {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #a5b4fc;
}

.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    z-index: 30;
}

.modal[hidden] {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 20, 0.65);
}

.modal__dialog {
    position: relative;
    width: min(840px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #0c1629;
    border: 1px solid #1e2a44;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal__title {
    margin: 0;
}

.modal__eyebrow {
    margin: 0;
    color: #6f7d97;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.modal__close {
    border: none;
    background: #152138;
    color: #c7d2e9;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
    cursor: pointer;
}

.modal__footer {
    margin-top: 1.5rem;
}

.modal__footer-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.confirm-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.confirm-section {
    background: #0a1121;
    border: 1px solid #1e2a44;
    border-radius: 12px;
    padding: 1rem;
}

.confirm-status {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #1e2a44;
    background: #0c1629;
    color: #c7d2e9;
}

.confirm-status--positive {
    border-color: #2e8b57;
    background: rgba(46, 139, 87, 0.15);
    color: #9ae2bc;
}

.confirm-status--warning {
    border-color: #b94a4a;
    background: rgba(185, 74, 74, 0.15);
    color: #f8c0c0;
}

.confirm-matches-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.confirm-matches {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.confirm-match {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #0c1629;
    border: 1px solid #1e2a44;
    border-radius: 10px;
}

.confirm-match__main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.confirm-match__name {
    margin: 0;
    font-weight: 600;
    color: #ffffff;
}

.confirm-match__meta {
    margin: 0;
    color: #9db2d4;
    font-size: 0.9rem;
}

.confirm-match__price {
    font-weight: 600;
    color: #9ae2bc;
}

.confirm-summary {
    margin-top: 0.75rem;
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 0.75rem;
    border-radius: 999px;
    background: #152138;
    color: #9db2d4;
    font-weight: 600;
}
