*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea {
  -webkit-touch-callout: default !important;
  -webkit-user-select: text !important;
  user-select: text !important;
}

:root {
  --bg-color: var(--tg-theme-bg-color, #121417);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #1a1e23);
  --card-bg: var(--tg-theme-section-bg-color, #22272e);
  --text-color: var(--tg-theme-text-color, #f0f3f6);
  --hint-color: var(--tg-theme-hint-color, #8b949e);
  --primary: var(--tg-theme-button-color, #2f80ed);
  --primary-text: var(--tg-theme-button-text-color, #ffffff);
  --border-color: rgba(255, 255, 255, 0.1);
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);

  --green: #2ecc71;
  --red: #e74c3c;
  --gray-closed: #6c757d;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-color: var(--tg-theme-bg-color, #f7f9fb);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #edf1f5);
    --card-bg: var(--tg-theme-section-bg-color, #ffffff);
    --text-color: var(--tg-theme-text-color, #1c2128);
    --hint-color: var(--tg-theme-hint-color, #656d76);
    --border-color: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  }
}

html, body {
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  overscroll-behavior-y: none !important;
  touch-action: pan-y;
}

#app {
  height: 100vh;
  height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none !important;
}

.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: var(--bg-color);
  z-index: 1;
  pointer-events: none;
  overscroll-behavior-y: none !important;
}

.screen.active {
  display: flex !important;
  z-index: 10 !important;
  pointer-events: auto !important;
}

/* iOS Safari: отступ от «чубчика»/статус-бара под viewport-fit=cover */
body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}


.app-header {
  padding: 16px 20px;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 20;
}

.logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo span { color: var(--primary); }

.nav-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  position: relative !important;
  z-index: 50 !important;
  pointer-events: auto !important;
}

.nav-header * { pointer-events: auto !important; }

.nav-header h2 { font-size: 18px; font-weight: 600; }

.editable-title {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 100px;
  position: relative;
  z-index: 5;
  pointer-events: auto !important;
  overscroll-behavior-y: contain !important;
  scrollbar-gutter: stable;
}

.form-content { padding-bottom: 50px; }

.cards-list { display: flex; flex-direction: column; gap: 12px; }

.item-card {
  background-color: var(--card-bg);
  padding: 16px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  transition: transform 0.1s ease, opacity 0.2s ease;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

.item-card * {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

.item-card:active { transform: scale(0.98); }

.item-card.is-invited-card { border-left: 4px solid var(--primary); }

.item-card.is-closed-card {
  opacity: 0.65;
  background-color: rgba(108, 117, 125, 0.1);
  border: 1px solid rgba(108, 117, 125, 0.3);
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.group-emoji { font-size: 20px; line-height: 1; }

.badge-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  vertical-align: middle;
}

.badge-tag.badge-date {
  background: var(--secondary-bg);
  color: var(--hint-color);
  border: 1px solid var(--border-color);
}

.badge-invited {
  background: rgba(47, 128, 237, 0.15);
  color: var(--primary);
  border: 1px solid rgba(47, 128, 237, 0.3);
}

.badge-closed {
  background: rgba(108, 117, 125, 0.2);
  color: var(--hint-color);
  border: 1px solid rgba(108, 117, 125, 0.4);
}

.badge-archived {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--hint-color); }
.card-amount { font-size: 16px; font-weight: 700; }

.custom-dropdowns-row { display: flex; gap: 12px; margin-bottom: 14px; }
.custom-dropdown-col { flex: 1; position: relative; }

.custom-dropdown-col label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--hint-color);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.custom-select-container { position: relative; }

.custom-select-trigger {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color) !important;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#screen-add-expense .custom-select-trigger,
#screen-create-debt .custom-select-trigger {
  background-color: var(--secondary-bg) !important;
  border-color: var(--border-color) !important;
}

.custom-select-trigger span { color: var(--text-color) !important; }
.custom-select-trigger:active { transform: scale(0.98); }

.arrow-indicator {
  font-size: 13px;
  color: var(--hint-color) !important;
  margin-left: 6px;
}

.custom-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 180px;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 1000 !important;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  .custom-dropdown-menu {
    background: #1c2128;
    border: 1px solid rgba(255, 255, 255, 0.15);
    scrollbar-color: var(--primary) rgba(255, 255, 255, 0.05);
  }
}

.custom-dropdown-menu::-webkit-scrollbar { width: 5px !important; display: block !important; }
.custom-dropdown-menu::-webkit-scrollbar-track { background: rgba(128, 128, 128, 0.1) !important; border-radius: 4px; }
.custom-dropdown-menu::-webkit-scrollbar-thumb { background: var(--primary) !important; border-radius: 4px; }
.custom-dropdown-menu.open { display: block; }

.custom-dropdown-item {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  color: #1c2128;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

@media (prefers-color-scheme: dark) { .custom-dropdown-item { color: #f0f3f6; } }
.custom-dropdown-item:active { opacity: 0.8; }
.custom-dropdown-item.active { background-color: #007aff !important; color: #ffffff !important; }

.emoji-grid-menu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
}

.emoji-grid-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 10px;
  background: var(--secondary-bg);
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.1s ease;
}

.emoji-grid-item:active { transform: scale(0.9); }
.emoji-grid-item.active { background: var(--primary) !important; }

.label-with-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.label-with-hint label { margin-bottom: 0 !important; }

.hint-question-btn {
  background: none !important;
  border: none !important;
  font-size: 16px !important;
  padding: 0 4px !important;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: transform 0.1s ease;
}

.hint-question-btn:active { transform: scale(0.85); }

#screen-add-expense input[type="text"],
#screen-add-expense input[type="number"],
#screen-add-expense input[type="date"],
#screen-create-debt input[type="text"],
#screen-create-debt input[type="number"],
#screen-create-debt input[type="date"],
#screen-create-debt select,
#screen-add-expense .custom-amount-input,
#screen-create-debt .debtor-name-input,
#screen-create-debt .debtor-amount-input,
#screen-create-debt #debt-payer-share,
#screen-create-debt #new-debt-payer {
  background-color: var(--secondary-bg) !important;
  border-color: var(--border-color) !important;
}

.segmented-control.readonly-mode {
  background-color: var(--secondary-bg) !important;
  border-color: var(--border-color) !important;
  opacity: 0.6;
}

.segmented-control.readonly-mode .seg-btn { cursor: not-allowed; }
.segmented-control.readonly-mode .seg-btn.active {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-color) !important;
  box-shadow: none !important;
}

.interactive-phone {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 6px;
  font-weight: 700;
  transition: opacity 0.15s ease;
}

.interactive-phone:active { opacity: 0.7; }

.action-icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto !important;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  transition: all 0.15s ease;
  box-shadow: var(--card-shadow);
}

.action-icon-btn:active {
  transform: scale(0.92);
  background-color: var(--secondary-bg);
}

.action-icon-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.nav-svg-icon { display: block; }

.tabs {
  display: flex;
  padding: 8px 16px;
  gap: 6px;
  background-color: var(--secondary-bg);
  position: relative;
  z-index: 20;
  margin-top: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px 6px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--hint-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn.active {
  background-color: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--card-shadow);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

@keyframes tab-slide-from-right { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
@keyframes tab-slide-from-left { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: translateX(0); } }

.tab-slide-from-right { animation: tab-slide-from-right 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-slide-from-left { animation: tab-slide-from-left 0.22s cubic-bezier(0.16, 1, 0.3, 1); }

.group-stats-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.stat-label { display: block; font-size: 13px; color: var(--hint-color); margin-bottom: 4px; }
.stat-val { font-size: 24px; font-weight: 800; }

.form-group {
  margin-bottom: 18px;
  position: relative;
  pointer-events: auto !important;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--hint-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  pointer-events: auto !important;
}

input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }

input:focus, select:focus { border-color: var(--primary); }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="date"] { cursor: pointer; }

.input-currency-wrapper { position: relative; display: flex; align-items: center; }
.input-currency-wrapper input { padding-right: 42px; }

.currency-tag {
  position: absolute;
  right: 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--hint-color);
  pointer-events: none !important;
  z-index: 2;
}

.dynamic-inputs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.member-input-row { display: flex; gap: 8px; align-items: center; }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  font-family: inherit;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  background-color: var(--primary);
  color: var(--primary-text);
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  position: relative;
  pointer-events: auto !important;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 0 3px 10px rgba(47, 128, 237, 0.25);
  font-family: inherit;
}

.btn-primary:active { opacity: 0.9; }

.fab-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
}

.fab-icon { font-size: 32px; line-height: 1; margin-top: -2px; }

/* FAB-меню */
.fab-menu {
  position: fixed;
  bottom: 92px;
  right: 24px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 29;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.fab-menu.open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-color);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s ease, background 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.fab-menu-item:active { transform: scale(0.96); background: var(--secondary-bg); }
.fab-menu-icon { font-size: 20px; line-height: 1; }

/* Главные табы */
.main-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.main-tab-btn {
  flex: 1;
  padding: 10px 6px;
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--hint-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.main-tab-btn.active {
  background: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--card-shadow);
}

.main-tab-btn:active { transform: scale(0.98); }

.settlements-card {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}

.settlement-card-row {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}

.settlement-card-row:last-child { margin-bottom: 0; }

.settlement-main-text {
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settlement-details-dropdown {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  font-size: 13px;
  color: var(--hint-color);
  line-height: 1.5;
}

.settlement-details-dropdown b { color: var(--text-color); }
.settlement-actions { margin-top: 12px; }

.btn-settle-pay {
  width: 100%;
  padding: 10px;
  background-color: var(--primary);
  color: var(--primary-text);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  font-family: inherit;
}

.btn-settle-pay:active { opacity: 0.85; }

.btn-settle-confirm {
  width: 100%;
  padding: 10px;
  background-color: var(--green);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.15s ease;
  font-family: inherit;
}

.btn-settle-confirm:active { opacity: 0.85; }

.pending-badge {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.3);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--hint-color);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.pos-val { color: var(--green); }
.neg-val { color: var(--red); }

.form-row-2 { display: flex; gap: 12px; }
.form-row-2 .form-group { flex: 1; }

.segmented-control {
  display: flex;
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.seg-btn {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--hint-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  font-family: inherit;
}

.seg-btn:active { transform: scale(0.97); }

.seg-btn.active {
  background-color: var(--card-bg);
  color: var(--primary);
  box-shadow: var(--card-shadow);
}

.seg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.split-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.split-member-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--card-shadow);
}

.split-left-part { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.split-left-part span { font-size: 15px; font-weight: 500; }

.split-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.split-share-val { font-size: 14px; color: var(--hint-color); font-weight: 600; }

.shares-control { display: flex; align-items: center; gap: 8px; }
.shares-info { text-align: right; min-width: 65px; }
.share-multiplier { font-size: 14px; font-weight: 600; }
.share-subtext { font-size: 11px; color: var(--hint-color); }

.step-btn {
  background-color: var(--secondary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}

.step-btn:active { background-color: var(--border-color); }

.custom-amount-input {
  width: 95px !important;
  height: 38px !important;
  padding: 0 10px !important;
  font-size: 15px !important;
  text-align: right;
  border-radius: 8px !important;
  background-color: var(--secondary-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
}

.custom-amount-input:focus { border-color: var(--primary) !important; }

.btn-delete {
  width: 100%;
  padding: 14px;
  background-color: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  position: relative;
  pointer-events: auto !important;
  font-family: inherit;
}

.btn-delete:active { background-color: rgba(231, 76, 60, 0.1); }

.group-nav-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  position: relative;
  z-index: 50 !important;
}

.nav-left-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.nav-left-group h2 {
  max-width: calc(100% - 30px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  z-index: 60 !important;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}

.modal-overlay.open { display: flex !important; pointer-events: auto !important; }

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  overflow: visible !important;
}

.admin-modal-card {
  max-width: 520px;
  height: 82vh;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.admin-modal-card .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 17px; font-weight: 700; }

.center-sheet-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.center-sheet-overlay.open {
  display: flex !important;
  opacity: 1;
  pointer-events: auto !important;
}

.center-sheet {
  width: 100%;
  max-width: 360px;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px 16px 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  pointer-events: auto;
}

.center-sheet-overlay.open .center-sheet { transform: scale(1); opacity: 1; }

.center-sheet-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

.sheet-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-color);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
  text-align: left;
  font-family: inherit;
}

.sheet-action-btn:active { transform: scale(0.98); background: var(--card-bg); }

.sheet-action-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(128, 128, 128, 0.15);
  border-radius: 10px;
  font-size: 16px;
  flex-shrink: 0;
}

.sheet-action-btn.danger {
  color: var(--red);
  border-color: rgba(231, 76, 60, 0.35);
  background: rgba(231, 76, 60, 0.06);
}

.sheet-action-btn.danger .sheet-action-icon { background: rgba(231, 76, 60, 0.15); }
.sheet-action-btn.danger:active { background: rgba(231, 76, 60, 0.12); }

.sheet-cancel-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: var(--hint-color);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sheet-cancel-btn:active { background: var(--secondary-bg); }

#modal-members .modal-body {
  max-height: 75vh !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  scrollbar-color: var(--primary) rgba(255, 255, 255, 0.08) !important;
  padding-right: 4px;
}

#modal-members .modal-body::-webkit-scrollbar { width: 5px !important; display: block !important; }
#modal-members .modal-body::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05) !important; border-radius: 4px; }
#modal-members .modal-body::-webkit-scrollbar-thumb { background: var(--primary) !important; border-radius: 4px; }

.member-item-manage {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--secondary-bg);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.member-item-manage span { font-size: 15px; font-weight: 500; }

.future-members-toggle {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
}

.checkbox-container { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-container input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.toggle-text { font-size: 14px; color: var(--text-color); font-weight: 500; }

.btn-claim-member {
  width: 100%;
  padding: 14px;
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  box-shadow: var(--card-shadow);
  font-family: inherit;
}

.btn-claim-member:active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.stat-admin-box { display: flex; flex-direction: column; gap: 10px; }

.stat-admin-item {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-admin-lbl { font-size: 14px; color: var(--hint-color); }
.stat-admin-val { font-size: 18px; font-weight: 800; color: var(--primary); }

.promo-banner {
  padding: 14px 16px;
  background-color: var(--secondary-bg);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  text-align: center;
}

.promo-text { font-size: 13px; color: var(--hint-color); line-height: 1.5; margin: 0; }
.promo-link { color: var(--primary); font-weight: 600; text-decoration: underline; cursor: pointer; }
.promo-link:active { opacity: 0.8; }

.auth-notice-card {
  background: rgba(47, 128, 237, 0.08);
  border: 1px solid rgba(47, 128, 237, 0.3);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}

.auth-bot-btn { margin-top: 12px; padding: 12px; font-size: 14px; }

.admin-subtabs { margin-bottom: 16px; background: transparent; padding: 0; }

.admin-user-card {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-user-info { display: flex; flex-direction: column; gap: 2px; }
.admin-user-name { font-size: 15px; font-weight: 600; }
.admin-user-sub { font-size: 12px; color: var(--hint-color); }

.btn-block-toggle {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-block-action {
  background: rgba(231, 76, 60, 0.15);
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-unblock-action {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
  border: 1px solid var(--green);
}

.btn-delete-user-action {
  background: rgba(231, 76, 60, 0.22) !important;
  color: var(--red) !important;
  border: 1px solid var(--red) !important;
}

.btn-delete-user-action:active { background: rgba(231, 76, 60, 0.35) !important; }

.toast-popup {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(26, 30, 35, 0.95);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  text-align: center;
  max-width: 86vw;
  width: max-content;
  white-space: pre-line !important;
  line-height: 1.4;
}

.toast-popup.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.receipt-empty-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  background-color: var(--secondary-bg);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  color: var(--hint-color);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.receipt-empty-area:active {
  background-color: var(--card-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.receipt-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
}

.receipt-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.receipt-thumb-wrap:active { transform: scale(0.95); }

.receipt-preview-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }

.receipt-zoom-hint {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 5px;
  padding: 2px 4px;
  font-size: 10px;
  line-height: 1;
}

.receipt-actions-col { display: flex; flex-direction: column; flex: 1; gap: 6px; min-width: 0; }

.receipt-hint-text {
  font-size: 12px;
  color: var(--hint-color);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-receipt-action {
  flex: 1;
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-family: inherit;
}

.btn-receipt-action:active { background: var(--primary); color: #fff; }

.btn-receipt-delete { color: var(--red); border-color: rgba(231, 76, 60, 0.35); }
.btn-receipt-delete:active { background: var(--red); color: #fff; }

#modal-about-service .modal-body {
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  scrollbar-color: var(--primary) rgba(255, 255, 255, 0.08) !important;
}

#modal-about-service .modal-body::-webkit-scrollbar { width: 6px !important; display: block !important; }
#modal-about-service .modal-body::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05) !important; border-radius: 4px; }
#modal-about-service .modal-body::-webkit-scrollbar-thumb { background: var(--primary) !important; border-radius: 4px; }

.history-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--card-shadow);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.history-pair {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-arrow { color: var(--primary); font-weight: 700; margin: 0 2px; }
.history-amount { font-size: 16px; font-weight: 700; color: var(--primary); flex-shrink: 0; }

.history-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.history-date { font-size: 12px; color: var(--hint-color); }

.history-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.history-status-confirmed {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
  border: 1px solid rgba(46, 204, 113, 0.35);
}

.history-status-pending {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.35);
}

.scrollbar-auto {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s ease;
}

.scrollbar-auto.is-scrolling { scrollbar-color: var(--primary) rgba(128, 128, 128, 0.1); }
.scrollbar-auto::-webkit-scrollbar { width: 6px; height: 6px; display: block; }
.scrollbar-auto::-webkit-scrollbar-track { background: transparent; }

.scrollbar-auto::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.scrollbar-auto.is-scrolling::-webkit-scrollbar-thumb { background: var(--primary); }
.scrollbar-auto.is-scrolling::-webkit-scrollbar-track { background: rgba(128, 128, 128, 0.1); }

.bot-activation-banner {
  display: none;
  background: linear-gradient(135deg, rgba(47, 128, 237, 0.14), rgba(47, 128, 237, 0.06));
  border: 1px solid rgba(47, 128, 237, 0.4);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(47, 128, 237, 0.12);
  width: 100%;
  box-sizing: border-box;
}

.bot-activation-title { font-size: 14px; font-weight: 700; color: var(--text-color); margin-bottom: 6px; }
.bot-activation-text { font-size: 13px; color: var(--hint-color); line-height: 1.45; margin-bottom: 12px; }

.bot-activation-btn {
  width: 100%;
  padding: 12px 14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.bot-activation-btn:active { transform: scale(0.98); opacity: 0.9; }

.btn-flag-lang {
  width: 100%;
  padding: 12px 14px;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  font-size: 30px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  margin-top: 12px;
  font-family: inherit;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

.btn-flag-lang:active { transform: scale(0.97); background: var(--card-bg); }
.btn-flag-lang #btn-lang-flag-emoji { display: inline-block; }

/* Просмотрщик фото чека */
.receipt-viewer {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: contain;
  touch-action: none;
}

.receipt-viewer.open { opacity: 1; }

.receipt-viewer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(8, 8, 10, 0.94);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  cursor: zoom-out;
  animation: receipt-backdrop-in 0.22s ease;
}

@keyframes receipt-backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.receipt-viewer-img {
  position: relative;
  z-index: 2;
  max-width: 96vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform-origin: center center;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  touch-action: none;
  will-change: transform;
  cursor: zoom-in;
  animation: receipt-img-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes receipt-img-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

.receipt-viewer-img.smooth { transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1); }

.receipt-viewer-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top, 16px));
  right: 16px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(24, 24, 28, 0.55);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.receipt-viewer-close:active {
  transform: scale(0.9);
  background: rgba(70, 70, 76, 0.9);
}

/* ============================================================
   ДОЛГИ: строки и блоки
   ============================================================ */
.debt-debtor-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.debt-debtor-row .debtor-name-input {
  flex: 1 1 auto;
  min-width: 0;
}

.debt-debtor-row .debtor-amount-input {
  flex: 0 0 110px;
  width: 110px;
  text-align: right;
  padding-right: 12px;
}

.debt-debtor-row .icon-btn { flex-shrink: 0; }

.debt-payer-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-color);
  font-size: 15px;
  font-weight: 600;
}

.debt-payer-readonly .payer-you-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(47, 128, 237, 0.15);
  color: var(--primary);
  border: 1px solid rgba(47, 128, 237, 0.35);
}

/* Блоки "Чек" */
.debt-data-block {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.debt-data-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--hint-color);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.debt-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
}

.debt-data-row:last-child { border-bottom: none; }

.debt-data-row .name-col {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.debt-data-row .name-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.debt-data-row .value-col {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.badge-mini {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(47, 128, 237, 0.15);
  border: 1px solid rgba(47, 128, 237, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}


.debt-share-view .amount-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.debt-share-view .amount-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.debt-share-view .auto-tag {
  font-size: 10px;
  color: var(--hint-color);
  text-transform: lowercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.debt-share-edit-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.debt-share-input {
  width: 90px !important;
  height: 36px !important;
  padding: 0 10px !important;
  font-size: 14px !important;
  text-align: right;
  border-radius: 8px !important;
  background-color: var(--card-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
}

.btn-mini {
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.btn-mini:active { opacity: 0.85; }

.btn-mini.secondary {
  background: var(--secondary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.debt-data-row-simple {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border-color);
}

.debt-data-row-simple:last-child { border-bottom: none; }

.debt-data-row-simple .lbl {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debt-data-row-simple .val {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.debt-data-row-simple .val.muted {
  color: var(--hint-color);
  font-weight: 500;
}

.debt-data-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border-color);
  font-size: 16px;
  font-weight: 800;
}

.debt-data-total .value {
  color: var(--text-color);
  font-size: 18px;
}

.debt-data-total .edit-mini {
  margin-left: 8px;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.debt-receipt-thumb-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}

.debt-receipt-thumb-wrap:active { transform: scale(0.95); }

.debt-receipt-detail-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.debt-receipt-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.debt-edit-input {
  width: 120px !important;
  height: 36px !important;
  padding: 0 10px !important;
  font-size: 14px !important;
  text-align: right;
  border-radius: 8px !important;
  background-color: var(--card-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
}

.debt-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Кнопка "Редактировать долг" */
.btn-edit-debt {
  width: 100%;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 14px;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-edit-debt:active {
  transform: scale(0.98);
  background: var(--secondary-bg);
}

/* Строка с base + tip */
.debt-share-view .amount-plus {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-share-view .amount-tip {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 500;
}


.btn-edit-debt:active {
  transform: scale(0.98);
  background: var(--secondary-bg);
}

/* base + tip в списке участников */
.debt-share-view .amount-plus {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-share-view .amount-tip {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 500;
}

/* Бейдж "это Вы" в модалке участников */
.member-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}


.btn-edit-debt:active {
  transform: scale(0.98);
  background: var(--secondary-bg);
}

/* base + tip в списке участников */
.debt-share-view .amount-plus {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-share-view .amount-tip {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 500;
}

/* Бейдж "это Вы" в модалке участников */
.member-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}



.share-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.share-edit-lbl {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 600;
  flex-shrink: 0;
}

.share-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}

.share-edit-block .debt-share-input {
  flex: 1;
  min-width: 0;
}

/* Блок редактирования своей доли */
.share-edit-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 240px;
}

.share-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.share-edit-lbl {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 600;
  flex-shrink: 0;
}

.share-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}


.btn-edit-debt:active {
  transform: scale(0.98);
  background: var(--secondary-bg);
}

.debt-share-view .amount-plus {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-share-view .amount-tip {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 500;
}

.member-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.member-name-wrap .badge-mini {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(47, 128, 237, 0.15);
  border: 1px solid rgba(47, 128, 237, 0.3);
  white-space: nowrap;
}

/* Меньше отступа снизу, когда FAB скрыт (долги) */
.content-scroll.no-fab {
  padding-bottom: 24px;
}


.debt-log-who {
  font-weight: 600;
  color: var(--text-color);
}

.debt-log-field {
  color: var(--hint-color);
  font-weight: 500;
}

.debt-log-values {
  color: var(--text-color);
  font-size: 14px;
  font-weight: 600;
}

.debt-log-values b {
  color: var(--primary);
}

.debt-log-arrow {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-log-date {
  color: var(--hint-color);
  font-size: 11px;
}

.debt-log-changes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.debt-log-line {
  font-size: 13px;
  color: var(--text-color);
  font-weight: 500;
}

.debt-log-line b {
  color: var(--primary);
}


.btn-edit-debt:active {
  transform: scale(0.98);
  background: var(--secondary-bg);
}

/* base + tip в списке участников */
.debt-share-view {
  display: flex;
  align-items: center;
  gap: 10px;
}

.debt-share-view .amount-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.debt-share-view .amount-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.debt-share-view .amount-plus {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-share-view .amount-tip {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 500;
}


.share-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.share-edit-lbl {
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 600;
  flex-shrink: 0;
}

.share-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}

.debt-share-input {
  width: 90px !important;
  height: 36px !important;
  padding: 0 10px !important;
  font-size: 14px !important;
  text-align: right;
  border-radius: 8px !important;
  background-color: var(--card-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--border-color) !important;
}

/* История изменений долга */
.debt-log-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
}

.debt-log-who {
  font-weight: 600;
  color: var(--text-color);
}

.debt-log-changes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.debt-log-line {
  font-size: 13px;
  color: var(--text-color);
  font-weight: 500;
}

.debt-log-line b {
  color: var(--primary);
}

.debt-log-field {
  color: var(--hint-color);
  font-weight: 500;
}

.debt-log-arrow {
  color: var(--hint-color);
  font-weight: 400;
  margin: 0 2px;
}

.debt-log-date {
  color: var(--hint-color);
  font-size: 11px;
}

/* Бейдж "это Вы" в модалке участников */
.member-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.debt-payer-lock {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.debt-debtor-row input.debtor-name-input[readonly] {
  cursor: default;
  background-color: var(--secondary-bg) !important;
}

.debt-debtor-row input.debtor-amount-input {
  background-color: var(--secondary-bg) !important;
  border-color: var(--border-color) !important;
}

/* Общий расход — карточка с чекбоксом и сноской */
.shared-expense-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  margin-bottom: 4px;
}
.shared-expense-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.shared-expense-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.shared-expense-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shared-expense-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.3;
}
.shared-expense-hint {
  font-size: 12px;
  color: var(--hint-color);
  line-height: 1.35;
}

/* Полноразмерная кнопка смены языка */
.btn-lang-full {
  width: 100%;
  margin-top: 12px;
  background: var(--secondary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-lang-full:active { opacity: 0.85; }

.form-hint {
  font-size: 12px;
  color: var(--hint-color);
  line-height: 1.4;
  margin-top: 8px;
}

/* Модалка настроек — тело скроллится, шапка остаётся на месте */
#modal-profile .modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}
#modal-about-service .modal-body,
#modal-admin .modal-body,
#modal-members .modal-body,
#modal-pairs-info .modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#push-hint {
  text-align: center;
  padding: 0 12px;
  margin-top: 10px;
}

/* Stealth-режим: скрываем всё, что выдаёт активность */
body.stealth-mode #bot-activation-banner,
body.stealth-mode #bot-activation-banner-details,
body.stealth-mode .promo-banner {
  display: none !important;
}

    .pd-currency-select {
      width: 100%;
      padding: 12px 14px;
      border-radius: 10px;
      background: var(--secondary-bg);
      color: var(--text-color);
      border: 1px solid var(--border-color);
      font-size: 14px;
      appearance: none;
      -webkit-appearance: none;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
      background-repeat: no-repeat;
      background-position: right 14px center;
      padding-right: 36px;
    }

/* ============================================================
   Страница авторизации (Web)
   ============================================================ */
.auth-content {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 20px 60px;
}

.auth-intro {
  text-align: center;
  margin-bottom: 22px;
}
.auth-intro h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-color);
}
.auth-intro p {
  font-size: 13.5px;
  color: var(--hint-color);
  line-height: 1.5;
}

.auth-method-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}
.auth-method-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.auth-method-icon { font-size: 22px; line-height: 1; }
.auth-method-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
}
.auth-method-desc {
  font-size: 13px;
  color: var(--hint-color);
  line-height: 1.45;
  margin-bottom: 14px;
}
.auth-method-hint {
  font-size: 12px;
  color: var(--hint-color);
  margin-top: 12px;
  text-align: center;
  line-height: 1.4;
}
.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.auth-success {
  font-size: 13px;
  color: var(--green);
  margin-bottom: 12px;
  line-height: 1.4;
}
.auth-code-input {
  font-size: 22px !important;
  text-align: center !important;
  letter-spacing: 6px !important;
  padding-left: 16px !important;
}
.auth-divider {
  position: relative;
  text-align: center;
  color: var(--hint-color);
  font-size: 12px;
  margin: 18px 0;
  text-transform: lowercase;
  letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 30px);
  height: 1px;
  background: var(--border-color);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-divider span {
  background: var(--bg-color);
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   Бейджи привязок в админке
   ============================================================ */
.admin-user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.admin-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.admin-badge-tg {
  background: rgba(47, 128, 237, 0.15);
  color: var(--primary);
  border: 1px solid rgba(47, 128, 237, 0.35);
}
.admin-badge-email {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
  border: 1px solid rgba(46, 204, 113, 0.35);
}
.admin-badge-none {
  background: rgba(128, 128, 128, 0.15);
  color: var(--hint-color);
  border: 1px solid rgba(128, 128, 128, 0.35);
}

/* ============================================================
   ПК-адаптация: ограничиваем ширину, центрируем
   ============================================================ */

/* ============================================================
   ПК-адаптация: ограничиваем ширину, центрируем
   ============================================================ */
@media (min-width: 768px) {
  .app-header,
  .nav-header,
  .tabs,
  .content-scroll {
    max-width: 560px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  /* .content-scroll имеет собственный padding — оставляем, но центрируем */
  .content-scroll {
    padding-left: 20px;
    padding-right: 20px;
  }
  /* FAB — прижимаем к правому краю контента, не viewport */
  .fab-btn {
    right: max(24px, calc((100vw - 560px) / 2 + 24px));
  }
  /* Модалки — тоже ограничиваем ширину */
  .modal-card {
    max-width: 480px;
  }
  .admin-modal-card {
    max-width: 560px;
  }
}