:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #d1d5db;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background-color: var(--bg);
}

.container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
}

body.page-login .container,
body.page-error .container {
    align-items: center;
}

.card {
    width: 100%;
    max-width: 360px;
    padding: 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card__title {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    line-height: 1.3;
}

.card__subtitle {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-form__label {
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.login-form__input {
    margin-bottom: 1.1rem;
    min-height: 44px;
    padding: 0.6rem 0.7rem;
    font-size: 1rem;
    color: var(--text);
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.login-form__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-form__button {
    min-height: 44px;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.login-form__button:hover {
    background-color: var(--primary-hover);
}

.login-form__button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.4);
    outline-offset: 2px;
}

.login-form__button,
.login-form__input {
    -webkit-tap-highlight-color: transparent;
}

.card--wide {
    max-width: 900px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th {
    text-align: left;
    font-weight: 700;
    background: #f8fafc;
}

.alert {
    margin: 0 0 1rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: #f3f4f6;
}

.alert--ok {
    color: #065f46;
    background: #ecfdf5;
}

.alert--error {
    color: #991b1b;
    background: #fef2f2;
}

.balance-box {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1.3rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: #eff6ff;
}

.balance-box__label {
    color: var(--muted);
    font-size: 0.95rem;
}

.balance-box__value {
    font-size: 1.25rem;
    color: #1e40af;
}

.section-block {
    margin-top: 1.1rem;
}

.section-block__title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.empty-state {
    margin: 0;
    color: var(--muted);
}

@media (min-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }
}

@media (min-width: 768px) {
    .card {
        padding: 2rem;
    }
}

@media (max-width: 600px) {
    .table-wrap {
        overflow-x: visible;
    }

    .data-table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .data-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .data-table tr {
        display: block;
        margin-bottom: 0.8rem;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: #fff;
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        white-space: normal;
        border: 0;
        border-bottom: 1px solid var(--border);
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--muted);
        flex: 0 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
