* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #f5f7fc 0%, #e9eef5 100%);
  color: #222;
  min-height: 100vh;
  padding: 0 15px;
}
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* BEGIN: Auth Page */
.login-container {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}
.login-container .ip-details {
  font-size: 0.875rem;
  color: #777;
  text-align: center;
  margin-top: 10px;
}
.login-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.02);
  padding: 2rem 1.8rem 2.2rem 1.8rem;
  transition: box-shadow 0.2s ease;
}
.login-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: #1a2c3e;
  text-align: center;
  margin-bottom: 1.8rem;
}

.input-group {
  margin-bottom: 1.4rem;
}
.login-card input {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 450;
  font-family: inherit;
  background-color: #fefefe;
  border: 1px solid #dce3ec;
  border-radius: 18px;
  transition: all 0.2s ease;
  outline: none;
  color: #11181c;
}
.login-card input:focus {
  border-color: #8ca3b9;
  box-shadow: 0 0 0 3px rgba(100, 120, 140, 0.15);
  background-color: #ffffff;
}
.login-card input::placeholder {
  color: #b2c0d0;
  font-weight: 400;
  font-size: 0.95rem;
}
.login-card button {
  width: 100%;
  background-color: #1f2f3e;
  border: none;
  padding: 0.85rem 1rem;
  border-radius: 40px;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  color: white;
  cursor: pointer;
  transition: background 0.2s, transform 0.05s;
  margin-top: 0.5rem;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
}
.login-card button:hover {
  background-color: #2c4053;
}
.login-card button:active {
  transform: scale(0.98);
}
.login-card button:focus-visible {
  outline: 2px solid #1f2f3e;
  outline-offset: 2px;
}
@media (max-width: 480px) {
  .login-card {
    padding: 1.6rem 1.4rem 1.8rem 1.4rem;
  }
  .login-card input {
    padding: 0.8rem 0.9rem;
  }
  .login-title {
    font-size: 1.6rem;
    margin-bottom: 1.4rem;
  }
}
/* END: Auth Page */

/* BEGIN: Main Page */
.wrapper {
  width: 500px;
}
.header-bg {
  background: #fff;
}
.header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;

  display: flex;
  align-items: center;
  justify-content: space-between;
  
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 14px 12px;
  
  position: sticky;
  top: 0;
  z-index: 10;
}
.header h1 {
  font-size: 18px;
  font-weight: 600;
}
.header p {
  font-size: 12px;
}
.header p b {
  color: #e65100;
}
.btn-create { background: #444; color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-create:active { opacity: 0.8; }

/* ФИЛЬТРЫ */
.filters {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;

  display: flex;
  gap: 8px;
  padding: 12px 14px;
  overflow-x: auto;

  max-width: 600px;
  margin: 0 auto;
}
.filters .search {
  flex-grow: 1;
  position: relative;
}
.filters .search input {
  border: 1px solid #ccc;
  border-radius: 20px;
  height: 100%;
  width: 100%;
  outline: none;
  padding-left: 30px;
}
.filters .search i {
  color: #ccc;
  position: absolute;
  top: 5px;
  left: 5px;
}
.filter-chip {
  cursor: pointer;
  
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 20px;
  
  color: #666;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  
  padding: 5px;
}
.filter-chip.active { background: #444; color: #fff; border-color: #444; }

.filter-chip span {
  background: #eee;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  
  display: inline-block;
  min-width: 20px;
  padding: 2px;
}
.filter-chip.active span { background: #777; }

/* СПИСОК */
.list {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 0 20px;
}
.empty { text-align: center; color: #999; font-size: 14px; padding: 40px 20px; }

/* КАРТОЧКА */
.card { background: #fff; border: 1px solid #e0e0e0; border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.card.OPEN {
  background: #fff5f5;
}
.card-top { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: #ddd; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: #666; overflow: hidden; }
.avatar img { cursor: zoom-in; width: 100%; height: 100%; object-fit: cover; }
.card-name { font-size: 14px; font-weight: 600; }
.card-phone { font-size: 12px; color: #888; margin-top: 2px; }
.badge { display: inline-block; border-radius: 20px; font-size: 11px; padding: 3px 10px; font-weight: 500; white-space: nowrap; }
.badge-open { background: #ffe3bb; color: #e65100; }
.badge-paid { background: #e8f5e9; color: #2e7d32; }

/* ПОЛЯ КАРТОЧКИ */
.card-fields { padding: 10px 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; border-top: 1px solid #f0f0f0; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 12px; font-weight: 500; color: #777; margin-bottom: 2px; }
.field-value { font-size: 13px; color: #333; }

/* ЗАЛОГ ФОТО */
.pledge-photo-wrap { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.pledge-photo-wrap img { cursor: zoom-in; width: 52px; height: 52px; border-radius: 8px; object-fit: cover; border: 1px solid #e0e0e0; }
.pledge-icon { width: 52px; height: 52px; border-radius: 8px; background: #f5f5f5; border: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: center; font-size: 22px; }

/* ПОДВАЛ КАРТОЧКИ */
.card-footer { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid #f0f0f0; background: #fafafa; }
.card-date { font-size: 11px; color: #999; }
.card-amount { font-size: 17px; font-weight: 600; }
.btn-edit { flex: 1; padding: 7px; border-radius: 8px; font-size: 12px; cursor: pointer; border: 1px solid #ddd; background: #fff; color: #444; }
.btn-delete { flex: 1; padding: 7px; border-radius: 8px; font-size: 12px; cursor: pointer; border: 1px solid #f5c6c2; background: #fff; color: #c0392b; }

/* МОДАЛЬНОЕ ОКНО */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 100; align-items: flex-end; }
.overlay.open { display: flex; }
.modal-bg {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 600px;
  margin: 0 auto;
  padding: 20px 16px 36px;
}
.modal {
  overflow-y: auto;
  max-height: 90vh;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 18px; }

/* ПОЛЯ ФОРМЫ */
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 500; color: #777; margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; font-size: 15px; padding: 10px 12px;
  border: 1px solid #ddd; border-radius: 10px;
  background: #fff; color: #222;
  -webkit-appearance: none; appearance: none;
}
.form-field textarea { resize: none; min-height: 80px; line-height: 1.5; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: #888; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ПЕРЕКЛЮЧАТЕЛЬ ТИП ЗАЛОГА */
.toggle-wrap { display: flex; border: 1px solid #ddd; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.toggle-btn { flex: 1; padding: 9px; font-size: 14px; border: none; background: #f5f5f5; color: #888; cursor: pointer; }
.toggle-btn.active { background: #444; color: #fff; }

/* ЗАГРУЗКА ФОТО */
.upload-area { border: 1.5px dashed #ccc; border-radius: 10px; padding: 22px; text-align: center; cursor: pointer; background: #fafafa; }
.upload-area p { font-size: 13px; color: #999; margin-top: 6px; }
.upload-area input { display: none; }
.upload-preview { width: 100%; max-height: 170px; object-fit: cover; border-radius: 10px; display: none; margin-top: 10px; }

/* КНОПКИ ФОРМЫ */
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-cancel { flex: 1; padding: 13px; border: 1px solid #ddd; background: #f5f5f5; color: #666; border-radius: 10px; font-size: 15px; cursor: pointer; }
.btn-save { flex: 1; padding: 13px; border: none; background: #444; color: #fff; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-save:active { opacity: 0.85; }

footer p {
  font-size: 0.875rem;
  color: #777;
  text-align: center;
  margin-bottom: 30px;
}
footer p a {
  color: #05d;
}
/* END: Main Page */