* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
}

.container {
  background: white;
  width: 100%;
  max-width: 720px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* Header */
header {
  background: #2c3e50;
  color: white;
  padding: 28px 32px;
  text-align: center;
}

header h1 {
  font-size: 1.8em;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

header p {
  font-size: 0.95em;
  opacity: 0.85;
}

/* Login */
.login-screen {
  padding: 40px 32px;
}

.login-screen .form-group {
  margin-bottom: 16px;
  text-align: left;
}

.login-screen .form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95em;
  color: #2c3e50;
}

.login-screen input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #dde1e6;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  color: #333;
  background: #fff;
  transition: border-color 0.2s;
}

.login-screen input[type="password"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.login-screen .message {
  margin: 12px 0 0;
}

/* Batch Form */
#batchForm {
  padding: 20px 32px 32px;
}

/* Entry rows */
.entry-row {
  background: #f8f9fa;
  border: 1px solid #e0e3e8;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.entry-main {
  display: flex;
  gap: 8px;
  align-items: center;
}

.entry-field {
  flex: 1;
}

.entry-name {
  flex: 2;
}

.entry-amount {
  flex: 1;
}

.entry-designation {
  flex: 1.5;
}

.entry-method {
  flex: 0.7;
}

.entry-other,
.entry-other-designation {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.entry-other input,
.entry-other-designation input {
  flex: 1;
}

.remove-btn {
  background: none;
  border: none;
  color: #c0392b;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}

.remove-btn:hover {
  background: #fde8e8;
}

/* Add buttons */
.add-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.add-btn {
  flex: 1;
  padding: 12px;
  background: #f0f2f5;
  color: #2c3e50;
  border: 2px dashed #c0c7d0;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.add-btn:hover {
  background: #e4e8ed;
  border-color: #3498db;
  color: #3498db;
}

.add-btn-cash {
  background: #f0f8f0;
  border-color: #6aad6a;
  color: #2d6b2d;
}

.add-btn-cash:hover {
  background: #e0f0e0;
  border-color: #4a9a4a;
  color: #1e5c1e;
}

.add-btn-secondary {
  background: #fff8f0;
  border-color: #d4a76a;
  color: #8b6914;
}

.add-btn-secondary:hover {
  background: #fff0dc;
  border-color: #c0922e;
  color: #7a5c0f;
}

/* Searchable dropdown */
.searchable-dropdown {
  position: relative;
}

.searchable-dropdown .member-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.clear-name-btn {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  font-size: 1.2em;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 50%;
  z-index: 2;
}

.clear-name-btn:hover {
  color: #c0392b;
  background: #fde8e8;
}

.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 2px solid #3498db;
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.95em;
  border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item:active {
  background: #e8f4fd;
  color: #2c3e50;
}

.dropdown-item.no-match {
  color: #888;
  cursor: default;
}

/* Non-member name fields stacked in the name column */
.entry-name .nonmember-name {
  width: 100%;
}

.address-fields {
  margin-top: 6px;
}

.address-fields input {
  width: 100%;
  margin-bottom: 4px;
  font-size: 0.9em;
}

.address-row {
  display: flex;
  gap: 6px;
}

.address-row .nonmember-city {
  flex: 3;
}

.address-row .nonmember-state {
  flex: 1;
  min-width: 50px;
  text-transform: uppercase;
}

.address-row .nonmember-zip {
  flex: 1.5;
  min-width: 70px;
}

/* Add to member list */
.add-to-list {
  margin-top: 6px;
}

.add-to-list-link {
  font-size: 0.85em;
  color: #3498db;
  text-decoration: none;
  cursor: pointer;
}

.add-to-list-link:hover {
  text-decoration: underline;
}

.add-to-list-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.picker-label {
  font-size: 0.85em;
  color: #555;
  font-weight: 600;
}

.picker-btn {
  padding: 4px 12px;
  font-size: 0.82em;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f8f9fa;
  color: #333;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.picker-btn:hover {
  background: #e8f4fd;
  border-color: #3498db;
  color: #2c3e50;
}

/* Who Counted */
.who-counted-section {
  margin-bottom: 16px;
}

.section-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95em;
  color: #2c3e50;
}

.min-note {
  font-weight: 400;
  color: #888;
  font-size: 0.85em;
}

.required {
  color: #e74c3c;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95em;
  cursor: pointer;
  padding: 4px 0;
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-other {
  grid-column: 1 / -1;
}

.other-counter-input {
  width: 200px;
  padding: 4px 8px;
  border: 2px solid #dde1e6;
  border-radius: 6px;
  font-size: 0.95em;
  font-family: inherit;
}

.other-counter-input:disabled {
  opacity: 0.4;
}

/* Totals */
.totals-section {
  margin-bottom: 16px;
}

.subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  font-size: 1em;
  font-weight: 600;
  color: #555;
  background: #f8f9fa;
  border-bottom: 1px solid #e8e8e8;
}

.subtotal-row:first-child {
  border-radius: 8px 8px 0 0;
}

.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2c3e50;
  color: white;
  padding: 14px 20px;
  border-radius: 0 0 8px 8px;
  font-size: 1.2em;
  font-weight: 700;
}

/* Submit section */
.submit-section {
  margin-top: 0;
}

.submit-btn {
  width: 100%;
  padding: 14px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.05em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover {
  background: #219a52;
}

.submit-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #dde1e6;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  color: #333;
  background: #fff;
  transition: border-color 0.2s;
}

select:focus,
input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Dollar prefix on amount input */
.input-with-prefix {
  position: relative;
}

.input-with-prefix .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-size: 1em;
  font-weight: 600;
  pointer-events: none;
}

.input-with-prefix input {
  padding-left: 30px;
}

/* Messages */
.message {
  margin: 0 32px 28px;
  padding: 16px 20px;
  border-radius: 8px;
  font-size: 0.95em;
  line-height: 1.5;
}

.message.success {
  background: #eaf5ea;
  border: 1px solid #27ae60;
  color: #1e6f3e;
}

.message.error {
  background: #fdf0f0;
  border: 1px solid #e74c3c;
  color: #c0392b;
}

/* Summary table */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9em;
}

.summary-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid #1e6f3e;
  color: #1e6f3e;
}

.summary-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #d4e8d4;
}

.summary-table .subtotal td {
  border-bottom: 1px solid #b8d4b8;
  font-weight: 600;
  color: #555;
}

.summary-table .grand-total td {
  border-top: 2px solid #1e6f3e;
  font-weight: 700;
  color: #1e6f3e;
  font-size: 1.05em;
}

.summary-counters {
  font-weight: 600;
  color: #555;
  margin-top: 8px;
}

.reset-btn {
  display: block;
  margin-top: 12px;
  padding: 8px 20px;
  background: #2c3e50;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background 0.2s;
}

.reset-btn:hover {
  background: #34495e;
}

/* Toast */
.toast {
  position: fixed;
  top: 150px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #2c3e50;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 700px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .container {
    border-radius: 0;
    max-width: 100%;
    min-height: 100vh;
    box-shadow: none;
  }

  header {
    padding: 24px 20px;
  }

  #batchForm {
    padding: 16px 16px 24px;
  }

  .entry-main {
    flex-wrap: wrap;
  }

  .entry-name {
    flex: 1 1 100%;
  }

  .entry-amount {
    flex: 1 1 45%;
  }

  .entry-method {
    flex: 1 1 45%;
  }

  .entry-designation {
    flex: 1 1 100%;
  }

  .message {
    margin: 0 16px 20px;
  }
}
