/* Палитра: основной, hover основного, второй (акцент), hover второго. Красный — только удаление/выход. */
:root {
    --color-primary: #1F6F68;
    --color-primary-hover: #288F87;
    --color-secondary: #A24936;
    --color-secondary-hover: #C25E47;
    /* Система шрифтов */
    --font-body: 16px;
    --font-secondary: 14px;
    --font-buttons: 16px;
    --font-heading-name: 18px;
    --font-teams-title: 28px;
    --font-modal-heading: 18px;
    /* WKWebView/Telegram: жёстко светлая схема, иначе WebKit игнорирует ::selection color */
    color-scheme: light !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* iOS Safari/WebView: автозум при фокусе на input, если font-size < 16px */
html {
    -webkit-text-size-adjust: 100%;
}

input,
textarea,
select {
    font-size: 16px;
    caret-color: #000;
}

/* Выделение текста: без * (ломается в WKWebView). Явные селекторы + ::selection/::-moz-selection. */
::selection {
    background: rgba(0, 122, 255, 0.35);
    color: #000;
}
::-moz-selection {
    background: rgba(0, 122, 255, 0.35);
    color: #000;
}
p::selection,
span::selection,
h1::selection,
h2::selection,
h3::selection,
h4::selection,
button::selection,
div::selection,
a::selection,
label::selection {
    background: rgba(0, 122, 255, 0.35);
    color: #000;
}
p::-moz-selection,
span::-moz-selection,
h1::-moz-selection,
h2::-moz-selection,
h3::-moz-selection,
h4::-moz-selection,
button::-moz-selection,
div::-moz-selection,
a::-moz-selection,
label::-moz-selection {
    background: rgba(0, 122, 255, 0.35);
    color: #000;
}
/* Кнопки с белым текстом: при выделении текст чёрный (иначе !important на color побеждает) */
.btn-primary::selection,
.btn-danger::selection,
.btn-add-expense-header::selection {
    color: #000;
}
.btn-primary::-moz-selection,
.btn-danger::-moz-selection,
.btn-add-expense-header::-moz-selection {
    color: #000;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--font-body);
    background: #ffffff !important;
    color: #000000 !important;
    line-height: 1.6;
    padding: 0;
    margin: 0;
    min-height: 100dvh;
}

/* Простые анимации переходов */
body.page-enter {
    animation: pageFadeIn 0.18s ease both;
}

body.page-exit-left {
    animation: pageFadeOutLeft 0.18s ease both;
}

body.page-exit-right {
    animation: pageFadeOutRight 0.18s ease both;
}

@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pageFadeOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-10px); }
}

@keyframes pageFadeOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(10px); }
}

/* Экран «Открой из Telegram» при открытии не из Telegram */
.telegram-only-screen {
    display: none;
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.telegram-only-content {
    max-width: 360px;
    text-align: center;
}
.telegram-only-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #000;
}
.telegram-only-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 16px;
    line-height: 1.5;
}
.telegram-only-hint {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 80px; /* Отступ для floating action button */
    background: #ffffff;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}



h1, h2, h3, h4, h5, h6 {
    color: #000000 !important;
}

p {
    color: #000000;
}

a {
    color: var(--color-primary);
}

a:visited {
    color: var(--color-primary);
}

li {
    color: #000000;
}

span {
    color: inherit;
}

header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

header h1 {
    font-size: 24px;
    margin-bottom: 4px;
    color: #000000 !important;
}

/* Главная: лого, центр, крупный заголовок */
.main-header {
    text-align: center;
}
.main-header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}
.main-header-logo {
    height: 48px;
    width: auto;
    display: block;
    object-fit: contain;
    border-radius: 50%;
}
.main-header-title {
    font-size: 28px !important;
    margin: 0 !important;
    color: #000000 !important;
}
.main-header .subtitle {
    margin: 0;
}

/* Team Header: одна строка — назад | название+смайлик (центр) | шестерёнка */
.team-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0px 0 10px;
    gap: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.team-header-back,
.team-header-settings {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--color-primary);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.team-header-back:hover,
.team-header-settings:hover {
    background: #f0f4f8;
    color: #666666;
}

.team-header-back .back-arrow-icon {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
}
.team-header-back .back-arrow-icon svg {
    stroke: currentColor;
}
.team-header-settings .settings-gear-icon {
    width: 22px;
    height: 22px;
}

/* Спейсер справа в шапке: показывается в настройках, чтобы «НАСТРОЙКИ» был по центру */
.team-header-spacer {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: none;
}

.team-header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
}

.team-header-center .team-emoji {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.team-header-center .team-name-header {
    font-size: var(--font-heading-name);
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Legacy (если где-то остались) */
.team-header .team-title { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 0; }
.team-emoji { font-size: 32px; line-height: 1; }
.team-title h1 { font-size: 28px; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: 0.5px; }

.subtitle {
    color: #666666;
    font-size: 14px;
}

.teams-section-title {
    font-size: var(--font-teams-title);
    margin-bottom: 10px;
}

.btn-back {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: var(--color-primary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back .back-arrow-icon {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}
.btn-back .back-arrow-icon svg {
    stroke: currentColor;
}

.btn-back:hover {
    background: #f5f5f5;
    border-color: var(--color-primary);
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: var(--font-buttons);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 8px;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff !important;
    margin-bottom: 0;
}

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

.btn-secondary {
    background: #f0f0f0;
    color: #000000 !important;
}

/* Удалить команду — главный красный акцент */
.btn-danger {
    background: #e53935;
    color: #ffffff !important;
    font-weight: 600;
}

.btn-danger:hover {
    background: #c62828;
}

/* Выйти из команды — внимание есть, но мягче чем удаление */
.btn-leave-team {
    background: #ffebee;
    color: #b71c1c !important;
    border: 1px solid #ef9a9a;
    font-weight: 500;
}

.btn-leave-team:hover {
    background: #ffcdd2;
    border-color: #e57373;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    width: auto;
    margin: 0 4px;
}

/* Экран */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Список команд */
.teams-list {
    margin-bottom: 16px;
}

/* Пустое состояние: без заголовка «Мои команды», текст по центру по вертикали */
.teams-screen-empty .teams-section-title {
    display: none;
}

/* Цепочка flex: контейнер → #app → экран → список, чтобы блок занял высоту и контент по центру */
#app {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.teams-screen-empty {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Центр по вертикали: равные отступы от заголовка сверху и от кнопки снизу */
.teams-screen-empty .teams-list {
    margin-top: auto;
    margin-bottom: auto;
    width: 100%;
}

.teams-screen-empty .teams-list .empty-state {
    font-size: var(--font-secondary);
}

.team-card {
    background: #e8e8e8;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.team-card h3 {
    font-size: var(--font-heading-name);
    margin-bottom: 8px;
    color: #000000;
}

.team-card p {
    font-size: var(--font-secondary);
    margin-bottom: 8px;
}

.team-card .btn {
    font-size: var(--font-buttons);
}

.team-card-stats {
    font-size: var(--font-secondary);
    color: #000000 !important;
    font-weight: 500;
}

.empty-state {
    font-size: var(--font-secondary);
    text-align: center;
    color: #666666;
    padding: 32px 16px;
}

.expenses-list {
    min-height: 200px;
    min-width: 0; /* flex-ребёнок может сжиматься — тогда ellipsis в карточках работает */
    display: block;
}

.expenses-list:has(.empty-state) {
    min-height: calc(100vh - 400px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Формы */
.form-group {
    margin-bottom: 16px;
}

.form-group:has(.char-counter) {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: var(--font-secondary);
    color: #000000;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: var(--font-body);
    background: #ffffff;
    color: #000000;
    margin-bottom: 0;
    display: block;
}

.form-group:has(.char-counter) input {
    margin-bottom: 0;
}

.form-group .char-counter {
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.form-group-inline label {
    margin-bottom: 0;
    flex: 1;
}

.form-group-inline input {
    flex: 1;
    margin-left: 8px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.form-actions .btn {
    flex: 1;
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 8px;
    color: #000000;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Вкладки */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #666666;
    font-size: var(--font-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Овальные кнопки переключения Расходы / Балансы */
.tabs.tabs-oval {
    border-bottom: none;
    gap: 10px;
    margin-bottom: 14px;
}

.tab.tab-oval {
    flex: 1;
    padding: 10px 16px;
    border-radius: 999px;
    border: 2px solid var(--color-primary);
    background: transparent;
    color: var(--color-primary);
    font-size: var(--font-body);
    font-weight: 500;
    border-bottom: 2px solid var(--color-primary);
}

.tab.tab-oval.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.tab.tab-oval:not(.active) {
    color: #666666;
    border-color: #ccc;
}

.tab.tab-oval:not(.active):hover {
    border-color: #999;
    color: #333;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Появление контента: выезд слева направо спустя 0,1 с после загрузки */
.entrance-slide {
    animation: entranceSlide 0.35s ease-out both;
    animation-delay: 0.1s;
}
@keyframes entranceSlide {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Открытие/закрытие модалки добавления расхода */
.expense-modal.is-open .expense-modal-content {
    animation: slideUp 0.35s ease;
}

.expense-modal.is-closing .expense-modal-content {
    animation: slideOutLeft 0.3s ease both;
}

@keyframes slideDownOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 1; }
}

#settings-content {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Уменьшаем отступ контейнера для вкладки настроек, так как там нет FAB кнопки */
body:has(#settings-tab.active) .container,
.container:has(#settings-tab.active) {
    padding-bottom: 24px !important;
}

/* Кнопка «Добавить расход» — контейнер 1в1 как у «Создать команду»: белая полоса внизу на всю ширину */
.expenses-header-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 600px;
    margin: 0 auto;
    display: none;
}
body.add-expense-visible .expenses-header-actions {
    display: flex;
}

/* Кнопка «Добавить расход» — 1в1 как «Создать команду»: на всю ширину, второй цвет, тень, скругление */
.btn-add-expense-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    background: var(--color-secondary);
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(162, 73, 54, 0.35);
}

.btn-add-expense-header:hover {
    background: var(--color-secondary-hover);
    box-shadow: 0 6px 16px rgba(162, 73, 54, 0.4);
}

.add-icon-small {
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.add-icon-small .icon-plus {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

/* Расходы (Tricount style) */
.expenses-summary {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 12px;
}

.expenses-summary.summary-bordered {
    background: #e8e8e8;
    border: 1px solid #d0d0d0;
}

.summary-divider {
    width: 1px;
    align-self: stretch;
    min-height: 40px;
    background: #c0c0c0;
}

.summary-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    color: #666666;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 20px;
    font-weight: 600;
    color: #000000;
}

/* При сумме ≥ 1 000 000 — чуть меньший шрифт, чтобы помещалось */
.expenses-summary.summary-large-amount .summary-value {
    font-size: var(--font-secondary);
}

.expense-date-group {
    margin-bottom: 24px;
}

.expense-date-header {
    font-size: var(--font-secondary);
    font-weight: 600;
    color: #000000;
    margin-bottom: 12px;
    padding: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expense-card {
    background: #e8e8e8;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.expense-card:hover {
    background: #dedede;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Кнопка удаления убрана с карточки: удаление через модалку */

.expense-details-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0 16px;
    border-bottom: 1px solid #e0e0e0;
}

.expense-details-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.expense-details-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Название и сумма в 2 строки, полностью (без обрезки) */
.expense-details-name {
    font-size: var(--font-body);
    font-weight: 700;
    color: #000000;
    margin: 0;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}

.expense-details-total {
    font-size: var(--font-heading-name);
    font-weight: 700;
    color: #000000;
    margin: 0;
    white-space: normal;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

.expense-details-sub {
    font-size: var(--font-secondary);
    color: #666666;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-details-section {
    padding-top: 16px;
}

.expense-details-section-title {
    font-size: var(--font-secondary);
    font-weight: 600;
    color: #000000;
    margin-bottom: 10px;
}

.expense-details-participants {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.expense-details-receipt {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 12px 14px;
}

.expense-details-receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: var(--font-body);
}

.expense-details-receipt-row.expense-details-receipt-tip {
    color: #666;
    border-top: 1px solid #eee;
    margin-top: 4px;
    padding-top: 10px;
}

.expense-details-receipt-row.expense-details-receipt-total {
    font-weight: 600;
    border-top: 1px solid #ddd;
    margin-top: 4px;
    padding-top: 10px;
}

.expense-details-receipt-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
}

.expense-details-receipt-amount {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.expense-details-receipt-ai-disclaimer {
    font-size: 10px !important;
    font-style: italic;
    color: #666;
    margin: 10px 0 0;
    line-height: 1.35;
}

.expense-details-receipt-photo-section {
    margin-top: 8px;
}

.expense-details-receipt-photo-wrap {
    position: relative;
    width: 100%;
}

.expense-details-receipt-photo {
    display: block;
    width: 100%;
    max-height: none;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.receipt-expand-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.receipt-expand-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.receipt-expand-btn svg,
.receipt-expand-btn .receipt-expand-icon {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}

/* Лайтбокс фото чека */
.receipt-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.receipt-lightbox.receipt-lightbox-visible {
    opacity: 1;
}

.receipt-lightbox.receipt-lightbox-closing {
    opacity: 0;
}

.receipt-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.receipt-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.receipt-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.receipt-lightbox-close .icon-close {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}

.receipt-lightbox-img {
    position: relative;
    z-index: 1;
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.participant-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.participant-row-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e0e0e0; /* Будет переопределяться inline стилем */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    font-size: var(--font-body);
}

.participant-row-info {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.participant-row-name {
    font-size: var(--font-body);
    font-weight: 500;
    color: #000000;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
    flex: 1;
}

.participant-row-amount {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    flex-shrink: 0;
    white-space: nowrap;
}

.expense-details-actions {
    margin-top: 16px;
}

.expense-icon {
    font-size: 24px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16%;
    flex-shrink: 0;
}

/* Карточка расхода: одна строка — название (12 символов), сумма с ellipsis, валюта полностью */
.expense-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.expense-header {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
}

.expense-header h3 {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-payer-info {
    font-size: var(--font-secondary);
    color: #666666;
    margin: 0;
}

/* Сумма: сжимается с ellipsis; валюта — всегда целиком */
.expense-amount-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    overflow: hidden;
}

.expense-amount-wrap .expense-amount {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.expense-amount-wrap .expense-currency {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.expense-payer-info {
    font-size: var(--font-secondary);
    color: #666666;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-info {
    margin-bottom: 12px;
}

.expense-info p {
    font-size: var(--font-secondary);
    margin-bottom: 4px;
    color: #666666;
}

.expense-info p strong {
    color: #000000;
}

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

/* Балансы (Tricount style) */
.balance-good-card {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.balance-good-icon {
    font-size: 48px;
    line-height: 1;
}

.balance-good-text {
    flex: 1;
}

.balance-good-text strong {
    display: block;
    font-size: var(--font-heading-name);
    font-weight: 600;
    color: #000000;
    margin-bottom: 4px;
}

.balance-good-text p {
    font-size: var(--font-secondary);
    color: #666666;
    margin: 0;
}

.balances-list {
    margin-top: 16px;
}

.balances-header {
    margin-bottom: 16px;
    padding: 0 4px;
}

.balances-header h3 {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    margin: 0;
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.balance-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e0e0e0; /* Будет переопределяться inline стилем */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    font-size: var(--font-body);
}

.balance-info {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.balance-name {
    font-size: var(--font-body);
    font-weight: 500;
    color: #000000;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
    flex: 1;
    min-width: 0;
}

.balance-me {
    font-size: var(--font-secondary);
    font-weight: 400;
    color: #666666;
}

.balance-amount {
    font-size: var(--font-body);
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.balance-amount.green {
    color: var(--color-primary);
}

.balance-amount.red {
    color: #f44336;
}

.balance-amount.black {
    color: #000000;
}

/* В блоке «Отчет»: имя на первой строке, долг/сумма — на второй */
.debts-list .balance-info {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.debts-list .balance-name {
    width: 100%;
    flex: none;
    padding-right: 0;
}
.debts-list .balance-amount {
    width: 100%;
    flex: none;
    font-size: var(--font-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Блок долга с прогрессом и кнопкой «Перевёл» */
.balance-item-debt .balance-info-debt {
    flex-wrap: wrap;
    align-items: flex-start;
}
.balance-item-debt .balance-info-debt .balance-name {
    flex: none;
    width: 100%;
}
.balance-item-debt .balance-info-debt .balance-amount {
    flex: none;
    width: 100%;
    font-size: var(--font-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.debt-progress-text {
    width: 100%;
    flex-basis: 100%;
    font-size: var(--font-secondary);
    color: #666666;
    margin-top: 6px;
    margin-bottom: 4px;
}
.debt-progress-bar {
    width: 100%;
    flex-basis: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.debt-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.2s ease;
}
.balance-item-debt .btn-settlement {
    flex-basis: 100%;
    width: 100%;
    margin-top: 4px;
    padding: 8px 12px;
    font-size: var(--font-buttons);
    font-weight: 500;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    cursor: pointer;
}
.balance-item-debt .btn-settlement:hover {
    background: var(--color-primary-hover);
    color: #fff;
    border-color: var(--color-primary-hover);
}

.debt-no-badge {
    font-weight: 500;
    font-size: var(--font-body);
}
.debt-no-badge.debt-no-simple {
    color: #666;
}
.debt-no-badge.debt-no-simple.debt-no-green {
    color: var(--color-primary);
}

/* Переключатель Расходы / Возвраты */
.debts-mode-toggle {
    display: flex;
    gap: 0;
    background: #e8e8e8;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}
.debts-mode-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: var(--font-body);
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.debts-mode-btn.active {
    background: #fff;
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.debts-panel {
    margin-top: 0;
}

/* Как лучше вернуть */
.debt-hint-list {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}
.debt-hint-item {
    font-size: var(--font-secondary);
    color: #333;
    padding: 4px 0;
}
.debt-hint-item:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}

/* История платежей */
.settlements-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.settlement-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 14px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
}
.settlement-history-text {
    font-size: var(--font-secondary);
    color: #333;
}
.settlement-history-date {
    font-size: var(--font-secondary);
    color: #888;
}

/* Модалка «Перевёл» */
.settlement-modal-body .settlement-modal-text,
.settlement-modal-body .settlement-remaining,
.settlement-modal-body .settlement-form label {
    font-size: var(--font-secondary);
    color: #333;
}

.settlement-remaining {
    margin: 0 0 10px 0;
    color: #666;
}
.settlement-form {
    margin-bottom: 14px;
}
.settlement-form label {
    display: block;
    margin-bottom: 4px;
}
.settlement-amount-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.settlement-amount-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}
/* 16px минимум — иначе iOS Safari при фокусе на поле автоматически приближает экран */
.settlement-amount-wrap input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 10px 0 10px 12px;
    font-size: 16px;
    background: transparent;
}
.settlement-currency-inline {
    flex-shrink: 0;
    padding: 0px 12px 0px 4px;
    font-size: 14px;
    color: #666;
}
.btn-settlement-full-inline {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-settlement-full-inline:hover {
    background: var(--color-primary-hover);
    color: #fff;
    border-color: var(--color-primary-hover);
}
.settlement-actions {
    display: flex;
    justify-content: stretch;
}
.settlement-actions .btn {
    flex: 1;
}

.balance-empty {
    padding: 40px 20px;
    text-align: center;
}

/* Настройки */
.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: var(--font-heading-name);
    margin-bottom: 16px;
    color: #000000;
}

/* Весь блок «Пригласить участников» — тот же фон, что у блока статистики расходов */
.settings-invite-wrapper {
    background: #e8e8e8;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    padding: 20px;
}
.settings-invite-wrapper .invite-section-header {
    margin-bottom: 12px;
}
.settings-invite-wrapper .invite-block {
    background: none;
    border: none;
    margin-bottom: 0;
    border-radius: 0;
}

.danger-section {
    margin-top: 24px;
    padding-top: 24px;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    border-top: 2px solid #ff4444;
}

.danger-section h3 {
    color: #ff4444;
}

.danger-hint {
    font-size: var(--font-secondary);
    color: #666666;
    margin-top: 8px;
    margin-bottom: 0;
    font-style: italic;
}

.add-participant-card {
    margin-top: 12px;
}

.btn-add-participant {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: 1px dashed #d0d0d0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-primary);
    font-weight: 500;
}

.btn-add-participant:hover {
    background: rgba(31, 111, 104, 0.08);
    border-color: var(--color-primary);
}

.add-icon {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.participant-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 8px;
}

.participant-info {
    flex: 1;
    color: #000000;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-primary);
    color: #ffffff;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

/* Фиксированная кнопка внизу */
.bottom-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.btn-bottom {
    position: relative;
    margin-bottom: 0;
}

/* Главная: кнопка «Создать команду» — акцент вторым цветом палитры */
#view-home .bottom-button-container .btn-primary {
    background: var(--color-secondary);
    color: #ffffff !important;
    font-size: var(--font-buttons);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(162, 73, 54, 0.35);
}
#view-home .bottom-button-container .btn-primary:hover {
    background: var(--color-secondary-hover);
    box-shadow: 0 6px 16px rgba(162, 73, 54, 0.4);
}

/* Модальное окно снизу */
.bottom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

/* Модалка PRO — поверх выпадающих списков (валюты и др.) */
#pro-upgrade-modal {
    z-index: 2000;
}

.bottom-modal.is-closing {
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.bottom-modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Плавное закрытие bottom-sheet */
.bottom-modal.is-closing .bottom-modal-content {
    animation: slideDownOut 0.3s ease both;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* «Создать команду» — экран фиксирован, футер в потоке. Высота 100vh (не 100dvh), чтобы при открытии клавиатуры контент не сжимался и кнопка не прыгала вверх. */
#create-team-modal.create-team-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

#create-team-modal.create-team-fullscreen .create-team-modal-content {
    position: absolute;
    inset: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    max-height: none;
    height: 100%;
    min-height: 100vh;
    border-radius: 0;
    animation: none;
    padding: 0 16px 0;
    padding-top: max(env(safe-area-inset-top, 0px), 12px);
}

.create-team-fullscreen.is-closing .create-team-modal-content {
    animation: none;
}

.create-team-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 10px;
    margin-bottom: 0;
    gap: 6px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.create-team-modal-header .create-team-back-btn {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.create-team-modal-header .back-arrow-icon {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
}
.create-team-modal-header .back-arrow-icon svg {
    stroke: currentColor;
}

.create-team-modal-title-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.create-team-modal-header .team-header-spacer {
    display: block;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
}

.create-team-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    padding: 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.create-team-fullscreen .create-team-modal-body {
    padding: 20px 0px;
    max-height: none;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.create-team-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#create-team-modal .create-team-form-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 16px 0;
}

#create-team-modal .create-team-form-footer {
    flex-shrink: 0;
    background: #fff;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.create-team-form-footer .btn-add-expense {
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bottom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10;
    flex-shrink: 0;
}

.bottom-modal-header h3 {
    font-size: var(--font-modal-heading);
    color: #000000;
    margin: 0;
}

.bottom-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 72px); /* минус высота шапки */
    scrollbar-gutter: stable;
    flex: 1;
    min-height: 0;
}

/* Для модалки создания команды — поля на всю ширину (тело уже с padding 16px) */
#create-team-modal .form-field {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Отступ между Название и Валюта 0px, между Валюта и Участники 14px */
#create-team-modal #create-team-form .create-team-form-body > .form-field:nth-child(1) {
    margin-bottom: 0;
}
#create-team-modal #create-team-form .create-team-form-body > .form-field:nth-child(2) {
    margin-bottom: 14px;
}

/* Убеждаемся, что список участников и элементы растягиваются на всю ширину */
#create-team-modal .participants-list-create {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

#create-team-modal .participant-item-create {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    display: flex !important;
}

#create-team-modal .participant-name-create {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
}

#create-team-modal .participant-item-create .remove-btn {
    flex: 0 0 44px !important;
    margin-left: auto !important;
}

/* Убеждаемся, что title-input-wrapper растягивается на всю ширину */
#create-team-modal .title-input-wrapper.with-counter {
    width: 100% !important;
    max-width: 100% !important;
}

#create-team-modal .title-input-wrapper.with-counter:not(:has(.camera-btn)) {
    grid-template-columns: auto 1fr !important;
}

#create-team-modal .title-input-wrapper.with-counter .title-input {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}


.bottom-modal-body p {
    font-size: var(--font-body);
    color: #000000;
    line-height: 1.5;
    white-space: pre-line;
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close-btn .icon-close,
.modal-close-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}
.modal-close-btn svg {
    fill: #666666;
    transition: fill 0.2s;
}

.modal-close-btn:hover {
    background: none;
}

.modal-close-btn:hover svg {
    fill: #000000;
}

.alert-actions,
.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.alert-actions .btn-primary,
.confirm-actions .btn-primary,
.confirm-actions .btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: var(--font-buttons);
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.confirm-actions {
    justify-content: space-between;
}

.confirm-actions .btn-secondary {
    flex: 1;
}

.confirm-actions .btn-primary {
    flex: 1;
}

/* Кнопки выбора действия — фон и border как у карточек команд */
.action-option-btn {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: #e8e8e8;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.action-option-btn:hover {
    background: #dedede;
    border-color: #c0c0c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-option-btn:active {
    transform: translateY(0);
}

/* Как в карточках расходов: без белой подложки, те же отступы */
.action-icon {
    font-size: 24px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-icon .icon-plus,
.action-icon .icon-brackets,
.action-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}
.action-icon svg {
    stroke: currentColor;
    fill: none;
}

.action-text {
    font-size: var(--font-body);
    font-weight: 500;
    color: #000000;
    flex: 1;
}

/* Тариф лайт: неактивные кнопки (видны, но заблокированы — по клику/наведению показывается попап PRO) */
.action-option-btn.disabled-by-plan,
.btn-disabled-by-plan {
    opacity: 0.6;
    cursor: not-allowed;
    background: #c8c8c8 !important;
    border-color: #b0b0b0 !important;
    pointer-events: auto;
}
.action-option-btn.disabled-by-plan:hover {
    transform: none;
    box-shadow: none;
}
/* Кнопка «Добавить расход» в неактивном состоянии — как «Создать новую команду» (серый фон, бордер) */
.btn-add-expense-header.disabled-by-plan {
    opacity: 0.6;
    cursor: not-allowed;
    background: #c8c8c8 !important;
    color: #666 !important;
    border: 1px solid #b0b0b0 !important;
    box-shadow: none !important;
    pointer-events: auto;
}
.btn-add-expense-header.disabled-by-plan:hover {
    background: #c8c8c8 !important;
    color: #666 !important;
    box-shadow: none !important;
    transform: none;
}
.wrapper-disabled-by-plan {
    position: relative;
    opacity: 0.75;
}
.wrapper-disabled-by-plan::after {
    content: '';
    position: absolute;
    inset: 0;
    cursor: not-allowed;
    z-index: 1;
}
#create-team-modal .new-participant-inputs-wrapper.disabled-by-plan input,
#create-team-modal .new-participant-inputs-wrapper.disabled-by-plan button {
    pointer-events: none;
}
#create-team-modal .new-participant-inputs-wrapper.disabled-by-plan,
.new-participant-inputs-wrapper.disabled-by-plan {
    position: relative;
    opacity: 0.7;
}
#create-team-modal .new-participant-inputs-wrapper.disabled-by-plan .plan-limit-overlay,
.new-participant-inputs-wrapper.disabled-by-plan .plan-limit-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: pointer;
}
.new-participant-inputs-wrapper.disabled-by-plan input,
.new-participant-inputs-wrapper.disabled-by-plan button {
    pointer-events: none;
}
.currency-field-disabled-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--color-text-secondary, #666);
    cursor: pointer;
    text-decoration: underline;
}
.currency-field-disabled-hint:hover {
    color: var(--color-primary, #2a7ae4);
}
/* Валюты, недоступные на тарифе лайт — серые, по клику показывается PRO */
.currency-item-disabled-by-plan {
    opacity: 0.5;
    color: #999 !important;
    cursor: pointer;
}
.currency-item-disabled-by-plan:hover {
    background: #f0f0f0;
}
.pro-upgrade-actions {
    margin-top: 16px;
}
.pro-upgrade-actions .btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

/* Модальное окно (старое, для совместимости) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: #ffffff;
    margin: 20px auto;
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    border-radius: 12px 12px 0 0;
    position: relative;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: var(--font-modal-heading);
    color: #000000;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close .icon-close,
.modal-close svg {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}
.modal-close svg {
    fill: #666666;
    transition: fill 0.2s;
}
.modal-close:hover svg {
    fill: #000000;
}

.modal-body {
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.error {
    color: #ff4444;
    padding: 16px;
    background: #ffe0e0;
    border-radius: 8px;
    margin: 16px 0;
}

/* Компонент выбора валюты */
.currency-selector-wrapper {
    position: relative;
    width: 100%;
}

.currency-selector-btn {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    text-align: left;
    color: #000000;
    height: 44px;
    box-sizing: border-box;
}

.currency-selector-btn:hover {
    border-color: var(--color-primary);
    background: rgba(31, 111, 104, 0.06);
}

.currency-selector-btn:focus,
.currency-selector-btn.active {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(31, 111, 104, 0.06);
}

.currency-selector-btn .currency-code {
    font-weight: 600;
    font-size: 18px;
    color: var(--color-primary);
    min-width: 60px;
}

.currency-selector-btn .currency-name {
    flex: 1;
    margin: 0 12px;
    color: #000000;
    text-align: left;
}

.currency-arrow-wrap {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.currency-selector-btn .currency-arrow {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: block;
}
.currency-selector-btn .currency-arrow-down {
    display: block;
}
.currency-selector-btn .currency-arrow-up {
    display: none;
}
.currency-selector-btn.active .currency-arrow-down {
    display: none;
}
.currency-selector-btn.active .currency-arrow-up {
    display: block;
}

.currency-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

/* Полноэкранный выбор валюты — как отдельный экран */
.currency-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.currency-modal .bottom-modal-content {
    position: absolute;
    inset: 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    max-height: none;
    height: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
    margin: 0;
    animation: slideUp 0.3s ease !important;
}

.currency-modal .bottom-modal-body {
    padding: 16px 16px 24px;
    max-height: none;
    flex: 1;
    min-height: 0;
}

.currency-modal .currency-dropdown {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    margin-top: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: none;
    overflow: visible;
    animation: none;
}

/* Поиск внутри валютной модалки */

.currency-search {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #ffffff;
    color: #000000;
}

.currency-search:focus {
    outline: none;
    border-color: var(--color-primary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.currency-section {
    padding: 8px 0;
}

.currency-section-title {
    padding: 12px 20px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.currency-no-results {
    padding: 24px 20px;
    text-align: center;
    font-size: 15px;
    color: #666;
}

.currency-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.currency-item:hover {
    background: #f5f5f5;
}

.currency-item.selected {
    background: rgba(31, 111, 104, 0.06);
    border-left-color: var(--color-primary);
}

.currency-item-code {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-primary);
    min-width: 60px;
}

.currency-item-name {
    flex: 1;
    color: #000000;
    margin-left: 12px;
}

.currency-item-symbol {
    color: #666666;
    font-size: 14px;
    margin-left: 8px;
}

.currency-empty {
    padding: 20px;
    text-align: center;
    color: #666666;
    font-size: 14px;
}

/* Floating Action Button (Tricount style) */
.fab {
    position: fixed !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    color: #ffffff;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(31, 111, 104, 0.35);
    transition: all 0.3s;
    z-index: 10000 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: translateX(-50%) translateY(-4px);
    box-shadow: 0 6px 20px rgba(31, 111, 104, 0.4);
}

.fab-icon {
    line-height: 1;
    font-weight: 300;
}

.fab-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
}

/* Expense Modal (Tricount style) */
.expense-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.expense-modal.is-open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 100dvh;
}

.expense-modal-content {
    background: #ffffff;
    min-height: 100dvh;
    padding: 0 16px 0;
    padding-top: max(env(safe-area-inset-top, 0px), 12px);
    flex: 1;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Хедер модалки добавления расхода — такая же высота и стиль, как у хедера с названием команды/настройками */
.expense-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 10px;
    margin-bottom: 0;
    gap: 6px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.expense-modal-header .team-header-back.expense-modal-back-btn {
    position: relative;
    top: auto;
    left: auto;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.expense-modal-header .back-arrow-icon {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
}
.expense-modal-header .back-arrow-icon svg {
    stroke: currentColor;
}

.expense-modal-title-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}

.expense-modal-header .team-header-spacer {
    display: block;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
}

.expense-modal-title {
    font-size: var(--font-modal-heading);
    font-weight: 700;
    margin: 0;
    padding: 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Transaction Type Tabs */
/* Expense Form: flex column — body скроллится, футер в потоке (не fixed), клавиатура не поднимает кнопку */
#expense-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.expense-form-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 0 0px 0;
}

.expense-form-body .form-field {
    margin-bottom: 12px;
}

/* Ноль отступов между Название, Сумма, Чаевые, Кто оплатил */
.expense-form-body .form-field:nth-child(1),
.expense-form-body .form-field:nth-child(2),
.expense-form-body .form-field:nth-child(3) {
    margin-bottom: 0;
}

.expense-form-body .char-counter {
    margin-bottom: 0;
}


.form-field label {
    display: block;
    font-size: var(--font-secondary);
    font-weight: 500;
    color: #000000;
    margin-bottom: 8px;
}

.char-counter {
    font-size: var(--font-secondary);
    color: #666;
    text-align: right;
    margin-top: 0;
    margin-bottom: 12px;
    line-height: 1;
}

.char-counter span {
    font-weight: 500;
}

/* === Счетчики: привязка к конкретным полям (не к соседним контролам) === */
.title-input-wrapper.with-counter {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.title-input-wrapper.with-counter .emoji-btn {
    grid-column: 1;
    grid-row: 1;
    flex-shrink: 0;
}

.title-input-wrapper.with-counter .title-input {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
}

.title-input-wrapper.with-counter .camera-btn {
    grid-column: 3;
    grid-row: 1;
    flex-shrink: 0;
}

.title-input-wrapper.with-counter:not(:has(.camera-btn)) {
    grid-template-columns: auto 1fr;
}

.title-input-wrapper.with-counter:not(:has(.camera-btn)) .title-input {
    grid-column: 2;
}

.title-input-wrapper.with-counter .char-counter {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    margin: 0;
    margin-top: 0;
    line-height: 1;
    height: 14px;
    padding: 0;
}

.expense-receipt-preview {
    margin-top: 10px;
}

.receipt-preview-label {
    font-size: 13px;
    color: var(--text-muted, #666);
    margin-bottom: 6px;
}

.receipt-preview-wrap {
    position: relative;
    display: inline-block;
    max-width: 50%;
    min-width: 140px;
}

.receipt-preview-img {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.receipt-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.receipt-preview-remove:hover {
    background: rgba(0, 0, 0, 0.8);
}

.amount-input-container.with-counter {
    display: grid;
    grid-template-rows: auto auto;
    row-gap: 2px;
    min-width: 0;
    align-self: flex-start;
}

.amount-input-container.with-counter .amount-input {
    grid-row: 1;
}

.amount-input-container.with-counter .char-counter {
    grid-row: 2;
    justify-self: end;
    margin: 0;
    line-height: 1;
    height: 14px; /* Фиксируем высоту счетчика, чтобы не влиял на выравнивание */
}

.add-participant-section.with-counter {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.add-participant-section.with-counter input {
    flex: 1;
    min-width: 0;
}

.add-participant-section.with-counter .add-participant-check {
    flex-shrink: 0;
    display: none; /* По умолчанию скрыта, не занимает место */
}

.add-participant-section.with-counter .add-participant-check:not([style*="display: none"]) {
    display: flex; /* Показывается только когда есть текст */
}

.add-participant-section.with-counter .char-counter {
    width: 100%;
    margin-top: 2px;
    margin-bottom: 0;
    text-align: right;
    line-height: 1;
}


/* Ошибка валидации: подсвечиваем ТОЛЬКО конкретный input/btn/list */
.form-field.field-error .title-input,
.form-field.field-error .amount-input,
.form-field.field-error .custom-dropdown-btn,
.form-field.field-error .participants-split-list,
.form-field.field-error .participants-list-create {
    border-color: #ff4444 !important;
    border-width: 2px !important;
    border-style: solid !important;
}

/* Для списков — без розового фона, только рамка как у остальных полей */
.form-field.field-error .participants-split-list,
.form-field.field-error .participants-list-create {
    background: transparent;
}

/* Если ошибка именно в сумме — НЕ подсвечиваем валюту справа */
#expense-amount-field.field-error .currency-selector-btn,
#expense-amount-field.field-error .currency-selector-wrapper .currency-selector-btn {
    border-color: #e0e0e0 !important;
    border-width: 1px !important;
}

/* Для формы создания команды: если ошибка в валюте — подсвечиваем селектор валюты */
#team-currency-field.field-error .currency-selector-btn,
#team-currency-field.field-error .currency-selector-wrapper .currency-selector-btn {
    border-color: #ff4444 !important;
    border-width: 1px !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.required-star {
    color: #ff4444;
    font-weight: bold;
    margin-left: 2px;
}

.title-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-sizing: border-box;
}

.icon-btn:hover {
    background: #f5f5f5;
    border-color: var(--color-primary);
}

.remove-btn:hover,
.icon-btn.remove-btn:hover {
    background: #ff4444 !important;
    border-color: #ff4444 !important;
    color: #ffffff !important;
}

.title-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: var(--font-body);
    background: #ffffff;
    color: #000000;
    height: 44px;
    box-sizing: border-box;
}

.title-input:hover,
.title-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.amount-input-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.amount-input-container {
    position: relative;
    /* Поле суммы занимает всё место слева до валюты */
    flex: 1 1 auto;
    min-width: 0;
}

.amount-input {
    width: 100%;
    padding: 10px 14px;
    padding-right: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: var(--font-body);
    font-weight: 600;
    background: #ffffff;
    color: #000000;
    height: 44px; /* Фиксируем высоту для выравнивания с кнопкой валюты */
    box-sizing: border-box;
}

.amount-input:hover,
.amount-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.amount-stepper {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: transparent;
    border: none;
    padding: 0;
}

.amount-step-btn {
    width: 20px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #666666;
    font-size: 10px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.amount-step-btn:hover {
    background: #eeeeee;
    border-color: #cccccc;
    color: #000000;
}

.currency-selector-inline {
    /* Валюта — отдельный блок справа, ширина по содержимому */
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
    align-self: flex-start;
}

/* В инлайн-режиме (рядом с суммой) показываем компактно, чтобы всё помещалось */
.currency-selector-inline .currency-selector-btn {
    padding: 10px 12px;
    width: auto;
    min-width: auto;
    white-space: nowrap;
    height: 44px; /* Фиксируем высоту для выравнивания с полем суммы */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.currency-selector-inline .currency-selector-btn:hover,
.currency-selector-inline .currency-selector-btn:focus,
.currency-selector-inline .currency-selector-btn.active {
    outline: none;
    border-color: var(--color-primary);
}

.currency-selector-inline .currency-name {
    display: none;
}

.currency-selector-inline .currency-code {
    font-size: 16px;
    min-width: 0;
    padding: 0 4px;
}

.currency-selector-inline .currency-arrow-wrap {
    margin-left: 4px;
}

.select-btn {
    width: 100%;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.select-btn:hover {
    background: #eeeeee;
    border-color: var(--color-primary);
}

.select-arrow-wrap {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.select-arrow-icon {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: block;
}
.select-arrow-down {
    display: block;
}
.select-arrow-up {
    display: none;
}
.custom-dropdown-btn.is-open .select-arrow-down {
    display: none;
}
.custom-dropdown-btn.is-open .select-arrow-up {
    display: block;
}

.select-arrow {
    color: #666666;
    font-size: 12px;
}

.select-input {
    width: 100%;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #000000;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    box-sizing: border-box;
}

.select-input:hover {
    background-color: #eeeeee;
    border-color: var(--color-primary);
}

.select-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #ffffff;
}

/* Кастомные dropdown */
.custom-dropdown-wrapper {
    position: relative;
    width: 100%;
}

.custom-dropdown-btn {
    width: 100%;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: var(--font-body);
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    transition: all 0.2s;
    box-sizing: border-box;
}

.custom-dropdown-btn:hover {
    background: #eeeeee;
    border-color: var(--color-primary);
}

.custom-dropdown-btn:focus,
.custom-dropdown-btn.active {
    outline: none;
    border-color: var(--color-primary);
    background: #ffffff;
}

.custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.custom-dropdown-list {
    padding: 4px 0;
}

.custom-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    color: #000000;
    font-size: var(--font-body);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.custom-dropdown-item:hover {
    background: #f5f5f5;
}

.custom-dropdown-item:active {
    background: rgba(31, 111, 104, 0.08);
}

.custom-dropdown-item.selected {
    background: rgba(31, 111, 104, 0.08);
    color: var(--color-primary);
    font-weight: 600;
}

.custom-dropdown-item.selected::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    background: url('/static/icons/check-black.png') center/contain no-repeat;
    vertical-align: middle;
}

/* Модальное окно календаря */
.datepicker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.datepicker-modal.is-closing {
    pointer-events: none;
}

.datepicker-modal.is-closing .datepicker-modal-content {
    animation: slideDownOut 0.3s ease both;
}

/* Закрытие emoji picker (как и открытие — снизу вверх/вниз) */
.emoji-picker-modal.is-closing {
    animation: fadeOut 0.3s ease both;
}

.emoji-picker-modal.is-closing .emoji-picker-content {
    animation: slideDownOut 0.3s ease both;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.datepicker-modal-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    max-width: 90%;
    width: 400px;
    max-height: 90vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
    overflow-y: auto;
}

.datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.datepicker-header h3 {
    font-size: var(--font-modal-heading);
    color: #000000;
    margin: 0;
}

.datepicker-close {
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.datepicker-close .icon-close,
.datepicker-close svg {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}
.datepicker-close svg {
    fill: #666666;
    transition: fill 0.2s;
}

.datepicker-close:hover {
    background: none;
}

.datepicker-close:hover svg {
    fill: #000000;
}

.datepicker-body {
    padding: 0;
}

.datepicker-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.datepicker-nav-btn {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #000000;
    transition: all 0.2s;
    padding: 0;
}

.datepicker-nav-btn:hover {
    background: #eeeeee;
    border-color: var(--color-primary);
}

.datepicker-nav-arrow {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}
.datepicker-nav-arrow.datepicker-nav-next {
    transform: rotate(180deg);
}

.datepicker-month-year {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    flex: 1;
    text-align: center;
}

.datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.datepicker-weekday {
    text-align: center;
    font-size: var(--font-secondary);
    font-weight: 600;
    color: #666666;
    padding: 8px 4px;
    text-transform: uppercase;
}

.datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 12px;
    height: 204px;
}

.datepicker-day {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #000000;
    transition: all 0.2s;
    background: transparent;
    border: 2px solid transparent;
}

.datepicker-day.empty {
    cursor: default;
    background: transparent;
}

.datepicker-day.future {
    color: #bbb;
    cursor: default;
    pointer-events: none;
}

.datepicker-day:hover:not(.empty) {
    background: #f5f5f5;
}

.datepicker-day.today {
    background: rgba(31, 111, 104, 0.08);
    border-color: var(--color-primary);
    font-weight: 600;
    color: var(--color-primary);
}

.datepicker-day.selected {
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
    border-color: var(--color-primary);
}

.datepicker-day.selected.today {
    background: var(--color-primary);
    color: #ffffff;
}

.datepicker-actions {
    display: flex;
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.datepicker-today-btn {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: var(--font-buttons);
    color: #000000;
    cursor: pointer;
    transition: all 0.2s;
}

.datepicker-today-btn:hover {
    background: #eeeeee;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.split-section {
    margin-top: 12px;
}

.participants-split-list {
    margin-top: 8px;
    background: transparent;
    border-radius: 0;
    padding: 0 0 0px 0; /* нижний отступ после последней строки */
    border: none; /* убираем внешнюю границу вокруг всех строк */
}

.form-error-message {
    margin-top: 8px;
    padding: 10px 12px;
    background: #ffebee;
    border: 1px solid #ff4444;
    border-radius: 8px;
    color: #c62828;
    font-size: 14px;
    display: none;
}

.participant-split-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 14px;
    min-height: 46px; /* визуально близко к строкам dropdown/ввода */
    background: #f5f5f5; /* серые строки участников */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    box-sizing: border-box;
    gap: 8px;
}

.participant-split-item:last-child {
    margin-bottom: 0;
}

.participant-split-checkbox {
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid #999;
    border-radius: 4px;
    background: #fff center/contain no-repeat;
    transition: border-color 0.2s, background-color 0.2s;
}
.participant-split-checkbox:hover {
    border-color: var(--color-primary, #1f6f68);
}
.participant-split-checkbox:checked {
    background-color: var(--color-primary, #1f6f68);
    border-color: var(--color-primary, #1f6f68);
    background-image: url('/static/icons/check-white.png');
    background-size: 12px 12px;
}

.participant-split-name {
    flex: 1 1 0;
    min-width: 0;
    font-size: var(--font-body);
    color: #000000;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    padding: 0;
}

.participant-split-amount {
    font-size: var(--font-body);
    font-weight: 600;
    color: #000000;
    text-align: right;
    display: flex;
    align-items: center;
    min-height: 24px;
    margin-left: auto;
    flex-shrink: 0;
}

.participant-split-amount .custom-amount-input {
    width: 128px;
    height: 34px; /* фиксируем высоту, чтобы строки были одинаковые */
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    background: #ffffff;
    color: #000000;
    text-align: right;
    line-height: 1;
    box-sizing: border-box;
}

/* Вспышка ошибки (например, когда ввели больше суммы расхода) */
.custom-amount-input:hover,
.custom-amount-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.custom-amount-input.input-error-flash {
    border-color: #ff4444 !important;
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.15);
}

.mini-amount-input {
    position: relative;
    display: inline-block;
}

.mini-amount-input .custom-amount-input,
.mini-amount-input .custom-share-input {
    padding-right: 12px; /* мини-стрелочки убрали */
}

/* Чуть шире поля для долей (если используется) */
.custom-share-input {
    width: 128px;
}

.mini-stepper {
    display: none !important;
}

.mini-step-btn {
    width: 20px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #666666;
    font-size: 10px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.mini-step-btn:hover {
    background: #eeeeee;
    border-color: #cccccc;
    color: #000000;
}

/* Футер формы расхода: в потоке (не fixed), клавиатура наезжает — кнопка не прыгает */
.expense-form-footer {
    flex-shrink: 0;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.expense-form-footer .btn-add-expense {
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-expense {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-expense:hover {
    background: var(--color-primary-hover);
}

/* Укажи дату и тип разделения в одну строку */
.expense-form-row.expense-form-row-two {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.expense-form-row-two .form-field {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.expense-form-row-two .split-section {
    margin-top: 0;
}

/* Create Team Form (Tricount style) */
.participant-warning {
    background: rgba(162, 73, 54, 0.1);
    border: 1px solid var(--color-secondary);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    color: var(--color-secondary);
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.participant-warning.warning-shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.participants-list-create {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
    width: 100%;
}

.participants-list-create.is-empty {
    display: none;
    margin-bottom: 0;
}

/* Если показываем ошибку “Добавь участника” — контейнер нужен, даже если пустой */
.form-field.field-error .participants-list-create.is-empty {
    display: flex;
    min-height: 46px;
}

.participant-item-create {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: flex-start;
}

.participant-avatar-create {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e0e0e0; /* Будет переопределяться inline стилем */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    font-size: 16px;
    font-size: 16px;
}

.participant-name-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.participant-name-wrap .participant-name-input,
.participant-name-create.participant-name-input {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    height: 44px;
    box-sizing: border-box;
    font-weight: 500;
    background: #fff;
    color: #000;
}

.participant-you-badge-inline {
    flex-shrink: 0;
    color: #666;
    font-size: 14px;
}

.new-participant-first-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 0;
}

.new-participant-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-participant-input-row .participant-input {
    flex: 1;
    min-width: 0;
}

/* Убираем системный синий highlight при тапе и лишний focus */
.icon-btn,
.participant-confirm-btn,
.participant-confirm-btn-inline,
.remove-btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.icon-btn:focus,
.participant-confirm-btn:focus,
.participant-confirm-btn-inline:focus,
.remove-btn:focus {
    outline: none;
    box-shadow: none;
}
.icon-btn:focus-visible,
.participant-confirm-btn:focus-visible,
.participant-confirm-btn-inline:focus-visible,
.remove-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
    border-radius: 10px;
}
.icon-btn:active,
.participant-confirm-btn:active,
.participant-confirm-btn-inline:active,
.remove-btn:active {
    background-color: rgba(0, 0, 0, 0.06);
}

.participant-confirm-btn .icon-check,
.remove-btn .icon-close {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

.remove-btn {
    position: relative;
}
.remove-btn .icon-close-hover {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.remove-btn:hover .icon-close:not(.icon-close-hover),
.remove-btn:focus .icon-close:not(.icon-close-hover) {
    opacity: 0;
}
.remove-btn:hover .icon-close-hover,
.remove-btn:focus .icon-close-hover {
    opacity: 1;
}

.receipt-preview-remove .icon-close.icon-close-sm {
    width: 16px;
    height: 16px;
}

.participant-confirm-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #000;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.participant-confirm-btn:hover,
.participant-confirm-btn:focus-visible {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}
.participant-confirm-btn:hover .icon-check,
.participant-confirm-btn:focus-visible .icon-check {
    filter: brightness(0) invert(1);
}

.participant-name-wrap .participant-confirm-btn-inline {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 14px;
    font-weight: 400;
}

.new-participant-first-row .char-counter {
    width: 100%;
    margin: 0;
    text-align: right;
    line-height: 1;
}

.new-participant-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.new-participant-inputs-wrapper .new-participant-inputs .char-counter {
    margin-top: 0;
    margin-bottom: 0;
}

.new-participant-inputs .participant-input {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    height: 44px;
    box-sizing: border-box;
    width: 100%;
}

.participant-item-create .remove-btn,
.participant-item-create .icon-btn.remove-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    max-width: 44px;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: auto;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.participant-item-create .remove-btn:focus,
.participant-item-create .icon-btn.remove-btn:focus {
    outline: none;
    background: #ffffff;
    border-color: #e0e0e0;
}

.participant-item-create .remove-btn:focus svg,
.participant-item-create .icon-btn.remove-btn:focus svg {
    fill: #666666;
}

.participant-item-create .remove-btn svg,
.participant-item-create .icon-btn.remove-btn svg {
    width: 20px;
    height: 20px;
    fill: #666666;
    transition: fill 0.2s;
}

.participant-item-create .remove-btn:hover {
    background: #ff4444 !important;
}

.participant-item-create .remove-btn:hover svg {
    fill: #ffffff;
}

.participant-badge-me {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-primary);
    color: #ffffff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.participant-name-create {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #000000;
    min-width: 0; /* Позволяет flex-элементу сжиматься */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.add-participant-section {
    display: flex;
    align-items: center;
    column-gap: 12px;
    row-gap: 0px; /* важно: чтобы счетчик не “отъезжал” вниз из-за flex-wrap */
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.add-participant-section .char-counter {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
}

.add-participant-section .remove-btn,
.add-participant-section .icon-btn.remove-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-participant-check {
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-sizing: border-box;
    padding: 0;
    color: #000000;
}

.add-participant-check svg {
    width: 20px;
    height: 20px;
    transition: fill 0.2s;
}

.add-participant-check:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #ffffff !important;
}

.participant-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #ffffff;
    color: #000000;
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
}

.participant-input:hover,
.participant-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.add-participant-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px dashed var(--color-primary);
    border-radius: 8px;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.add-participant-btn:hover {
    background: rgba(31, 111, 104, 0.06);
    border-color: var(--color-primary);
}

/* Адаптивность */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
    }
    
    .modal-content {
        max-width: 600px;
        border-radius: 12px;
        margin: 40px auto;
    }
    
    .currency-dropdown {
        max-height: 500px;
    }
    
    .emoji-picker-content {
        width: 450px;
    }
}

/* Модальное окно выбора эмодзи */
.emoji-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.emoji-picker-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    max-width: 90%;
    width: 400px;
    max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.emoji-picker-header h3 {
    font-size: 18px;
    color: #000000;
    margin: 0;
}

.emoji-picker-close {
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.emoji-picker-close .icon-close,
.emoji-picker-close svg {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}
.emoji-picker-close svg {
    fill: #666666;
    transition: fill 0.2s;
}

.emoji-picker-close:hover {
    background: none;
}

.emoji-picker-close:hover svg {
    fill: #000000;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    box-sizing: border-box;
}

.emoji-picker-item {
    background: #f5f5f5;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 32px;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    margin: 0;
}

.emoji-picker-item:hover {
    background: #e8e8e8;
    border: 1px solid var(--color-primary);
    transform: scale(1.05);
    z-index: 1;
    position: relative;
}

.emoji-picker-item:active {
    transform: scale(0.95);
}

@media (min-width: 1024px) {
    .expense-modal-content {
        max-width: 600px;
        margin: 0 auto;
        border-radius: 0;
    }
    
    .fab {
        right: calc(50% - 300px + 24px);
        left: auto;
        transform: none;
    }
    
    .fab:hover {
        transform: translateY(-4px);
    }
}

/* Блок приглашения участников */
.invite-block {
    background: linear-gradient(160deg, #f0f4f8 0%, #e2e8f0 100%);
    border-radius: 16px;

    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Строка заголовка «Пригласить участников» + код команды справа */
.invite-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.invite-section-header h3 {
    margin: 0;
}

.invite-code-badge-top {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    letter-spacing: 0.12em;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.invite-code-badge-top:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.invite-code-badge-top::after {
    content: 'Код команды';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%) translateY(-6px);
    padding: 6px 10px;
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: normal;
    white-space: nowrap;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.invite-code-badge-top:hover::after {
    opacity: 1;
    visibility: visible;
}

.invite-code-badge-top.invite-code-copied::after {
    content: 'Скопировано';
}

.invite-code-badge-top.invite-code-copied:hover::after {
    opacity: 1;
    visibility: visible;
}

.invite-subtitle {
    font-size: 14px;
    color: #000;
    margin: 0 0 12px 0;
}

.invite-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Кнопка «Отправить ссылку» — как «Сохранить», зелёная */
.btn-invite-green {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--color-primary) !important;
    color: #fff !important;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    margin-bottom: 0;
}

.btn-invite-green:hover {
    background: var(--color-primary-hover) !important;
}

.btn-invite-green .btn-invite-icon {
    font-size: 18px;
}

/* Старые большие кнопки приглашения (если используются) */
.btn-invite-send {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-invite-send:active {
    transform: scale(0.98);
}

.btn-invite-send .btn-invite-icon {
    font-size: 20px;
}

.btn-invite-send .btn-invite-label {
    letter-spacing: 0.02em;
}

.btn-invite-link {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
}

.btn-invite-link:hover {
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.btn-invite-code {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.btn-invite-code:hover {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Старые кнопки приглашения (если где-то остались) */
.btn-invite {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-invite .copy-icon,
.btn-invite .share-icon {
    font-size: 16px;
}

.btn-invite.btn-copy {
    background: var(--color-primary);
    color: #fff;
}

.btn-invite.btn-copy:hover {
    background: #2878d4;
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.35);
}

.btn-invite.btn-share {
    background: var(--color-primary);
    color: #fff;
}

.btn-invite.btn-share:hover {
    background: #16a34a;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}

.btn-invite:active {
    transform: scale(0.98);
}

.invite-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    letter-spacing: 0.08em;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Старые классы для совместимости (если используются вне invite-block) */
.invite-section {
    margin-bottom: 16px;
}

.invite-section:last-child {
    margin-bottom: 0;
}

.invite-section label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #000000;
    margin-bottom: 8px;
}

.invite-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.invite-input-group .invite-input {
    flex: 1;
    min-width: 200px;
}

.invite-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    color: #000000;
    font-family: monospace;
    min-width: 0;
}

.invite-input:hover,
.invite-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Единая тонкая активная рамка (1px, как у кнопки валюты): при наведении и при фокусе */
input[type="text"]:hover,
input[type="text"]:focus,
input[type="number"]:hover,
input[type="number"]:focus,
input[type="email"]:hover,
input[type="email"]:focus,
input[type="tel"]:hover,
input[type="tel"]:focus,
input:hover:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
input:focus:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
textarea:hover,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

#team-name:hover,
#team-name:focus,
#new-participant-name:hover,
#new-participant-name:focus,
#team-code:hover,
#team-code:focus,
#expense-name:hover,
#expense-name:focus,
.form-group input[type="text"]:hover,
.form-group input[type="text"]:focus,
.form-group input[type="number"]:hover,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Поле «Сумма перевода» (возврат долга): одна рамка на обёртке (input без своей рамки) */
.settlement-amount-wrap:hover,
.settlement-amount-wrap:focus-within {
    border-color: var(--color-primary);
    outline: none;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-copy:hover {
    background: var(--color-primary);
}

.btn-copy:active {
    transform: scale(0.98);
}

.copy-icon {
    font-size: 16px;
}

.copy-text {
    font-size: 14px;
}

/* Кнопка "Поделиться" */
.btn-share {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-share:hover {
    background: #45a049;
}

.btn-share:active {
    transform: scale(0.98);
}

.share-icon {
    font-size: 16px;
}

.share-text {
    font-size: 14px;
}

/* Блок пользователей с доступом */
.access-user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 8px;
}

.access-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.access-user-info strong {
    font-size: 14px;
    color: #000000;
}

/* Участники в настройках - отдельные блоки для имени и крестика */
.participant-item-settings {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.participant-avatar-settings {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e0e0e0; /* Будет переопределяться inline стилем */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    font-size: 16px;
}

.participant-name-wrap-settings {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.participant-item-settings .participant-name-input-settings,
.participant-name-settings.participant-name-input-settings {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    height: 44px;
    box-sizing: border-box;
    font-weight: 500;
    background: #fff;
    color: #000;
}

.participant-name-settings {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #ffffff;
    color: #000000;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.participant-you-badge {
    color: #666;
    font-size: 14px;
    font-weight: 400;
    margin-left: 4px;
}

.participant-left-badge {
    color: #999;
    font-size: 13px;
    font-style: italic;
}

.participant-item-settings.participant-left {
    opacity: 0.85;
}

.participant-item-settings .remove-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.participant-item-settings .remove-btn svg {
    width: 20px;
    height: 20px;
    fill: #666666;
    transition: fill 0.2s;
}

.participant-item-settings .remove-btn:hover {
    background: #ff4444 !important;
}

.participant-item-settings .remove-btn:hover svg {
    fill: #ffffff;
}

/* Модалка «Кто вы в команде» (после присоединения) — как блок участников в настройках */
.identity-modal-text {
    margin: 0 0 12px;
    color: #333;
    font-size: var(--font-body);
}
.identity-participants-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
/* Строка: круг слева «вне» блока с именем, имя в отдельной рамке */
.identity-participant-item {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    min-height: 44px;
    padding: 0;
    text-align: left;
    border: none;
    background: transparent;
    box-sizing: border-box;
}
.identity-participant-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    flex-shrink: 0;
    margin-right: 10px;
    border: none;
}
.identity-participant-name-wrap {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}
.identity-participant-item .identity-participant-name {
    font-size: 16px;
    font-weight: 500;
    color: #000;
}
.identity-participant-btn {
    cursor: pointer;
    border: none;
    background: transparent;
}
.identity-participant-btn .identity-participant-name-wrap:hover {
    background: #f5f5f5;
}
.identity-participant-taken {
    opacity: 0.85;
    cursor: default;
    pointer-events: none;
}
.identity-participant-taken .identity-participant-name {
    color: #666;
}
.identity-taken-badge {
    font-size: 13px;
    font-weight: 400;
    color: #999;
}
.identity-add-new-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.identity-new-name-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 0;
}
.identity-new-name-row .identity-new-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    height: 44px;
}
.identity-new-name-row .char-counter {
    margin: 0;
    text-align: right;
    font-size: 12px;
    color: #666;
}
.identity-add-new-block .identity-done-btn {
    margin-top: 20px;
}

/* Модалка «Как вас тогда зовут?» */
.rename-self-text {
    margin: 0 0 12px 0;
    color: #333;
}
.rename-self-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 16px;
}
.rename-self-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Пользователи с доступом в настройках - отдельные блоки для имени и крестика/бейджа */
.access-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.access-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e0e0e0; /* Будет переопределяться inline стилем */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    font-size: 16px;
}

.access-user-name {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #ffffff;
    color: #000000;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    font-weight: 500;
    gap: 8px;
}

.access-user-name .admin-text {
    color: #666666;
    font-size: 14px;
    font-weight: 400;
    margin-left: auto;
}

.access-user-item .remove-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.access-user-item .remove-btn svg {
    width: 20px;
    height: 20px;
    fill: #666666;
    transition: fill 0.2s;
}

.access-user-item .remove-btn:hover {
    background: #ff4444 !important;
}

.access-user-item .remove-btn:hover svg {
    fill: #ffffff;
}

.admin-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--color-primary);
    color: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

#access-users-list {
    min-height: 40px;
}

#access-users-list p {
    color: #666666;
    font-size: 14px;
    margin: 0;
}

#access-users-list .error-text {
    color: #d32f2f;
}

/* SPA: переключение экранов без перезагрузки */
.view {
    display: none;
}
.view.view-active {
    display: block;
}

/* Стабильный лейаут: отступ под кнопку «Добавить расход» с первого кадра (без прыжка) */
.container:has(#view-team.view-active) {
    padding-bottom: 100px;
}
.container:has(#settings-tab.active) {
    padding-bottom: 24px !important;
}

/* Резерв места под блоки, чтобы не было моргания при подгрузке данных */
.expenses-summary.summary-bordered {
    min-height: 72px;
}
#expenses-list {
    min-height: 60px;
}
#debts-content {
    min-height: 120px;
}
#debts-content:empty {
    min-height: 120px;
}

/* На десктопе крестик и галочка на белом фоне, при наведении — красный/зелёный */
@media (hover: hover) {
    .participant-item-create .remove-btn,
    .participant-item-create .icon-btn.remove-btn {
        background: #ffffff;
        border-color: #e0e0e0;
    }
    .participant-item-create .remove-btn svg,
    .participant-item-create .icon-btn.remove-btn svg {
        fill: #666666;
    }
    .participant-confirm-btn,
    .participant-confirm-btn-inline,
    #settings-new-participant-confirm-btn {
        background: #fff;
        border-color: #e0e0e0;
        color: #000;
    }
}

/* На мобилках и планшетах (нет курсора) фокус не меняет вид — кнопки остаются красные/зелёные как есть, без подсветки */
@media (hover: none) {
    *:focus {
        outline: none !important;
    }
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus,
    [tabindex]:focus,
    .icon-btn:focus,
    .remove-btn:focus,
    .btn:focus,
    .btn-add-expense:focus,
    .btn-danger:focus,
    .custom-dropdown-btn:focus,
    .currency-selector-btn:focus,
    .participant-name-input:focus,
    .participant-input:focus,
    .title-input:focus,
    .amount-input:focus {
        -webkit-tap-highlight-color: transparent;
        outline: none !important;
    }
    /* На мобильных при фокусе — та же тонкая зелёная рамка 1px */
    input:focus,
    textarea:focus,
    .title-input:focus,
    .amount-input:focus,
    .participant-input:focus,
    .participant-name-input:focus,
    .custom-amount-input:focus {
        border-color: var(--color-primary) !important;
    }
    .settlement-amount-wrap:focus-within {
        border-color: var(--color-primary) !important;
    }
    /* Кнопки-селекторы (dropdown, валюта) на тапе не меняем — оставляем как есть */
    .custom-dropdown-btn:focus,
    .currency-selector-btn:focus {
        border-color: #e0e0e0 !important;
    }
    /* На телефоне крестик и галочка всегда цветные: красный и зелёный */
    .participant-item-create .remove-btn,
    .participant-item-create .icon-btn.remove-btn {
        background: #ff4444 !important;
        border-color: #ff4444 !important;
    }
    .participant-item-create .remove-btn .icon-close:not(.icon-close-hover) {
        opacity: 0 !important;
    }
    .participant-item-create .remove-btn .icon-close-hover {
        opacity: 1 !important;
    }
    .participant-item-create .remove-btn svg,
    .participant-item-create .icon-btn.remove-btn svg {
        fill: #ffffff !important;
    }
    #create-team-modal .participant-confirm-btn,
    #create-team-modal .participant-confirm-btn-inline,
    .new-participant-first-row .participant-confirm-btn,
    #settings-new-participant-confirm-btn {
        background: var(--color-primary) !important;
        border-color: var(--color-primary) !important;
        color: #ffffff !important;
    }
    #create-team-modal .participant-confirm-btn .icon-check,
    #create-team-modal .participant-confirm-btn-inline .icon-check,
    .new-participant-first-row .participant-confirm-btn .icon-check,
    #settings-new-participant-confirm-btn .icon-check {
        filter: brightness(0) invert(1);
    }
    .participant-item-settings .remove-btn {
        background: #ff4444 !important;
        border-color: #ff4444 !important;
    }
    .participant-item-settings .remove-btn .icon-close:not(.icon-close-hover) {
        opacity: 0 !important;
    }
    .participant-item-settings .remove-btn .icon-close-hover {
        opacity: 1 !important;
    }
    .participant-item-settings .remove-btn svg {
        fill: #ffffff !important;
    }
    .access-user-item .remove-btn {
        background: #ff4444 !important;
        border-color: #ff4444 !important;
    }
    .access-user-item .remove-btn .icon-close:not(.icon-close-hover) {
        opacity: 0 !important;
    }
    .access-user-item .remove-btn .icon-close-hover {
        opacity: 1 !important;
    }
    .access-user-item .remove-btn svg {
        fill: #ffffff !important;
    }
    .btn-add-expense:focus {
        background: var(--color-primary) !important;
        border-color: transparent !important;
        color: #ffffff !important;
    }
    .btn-danger:focus {
        background: var(--color-secondary) !important;
        color: #ffffff !important;
    }
}

