/* Family Money Ledger — Mobile-First Styles */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a2e;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* Balance Section */
.balance-section {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
}

.balance-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.balance-amount {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}

.btn-add {
  background: #e94560;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-add:active {
  background: #c0392b;
}

/* Forms */
.add-form {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.add-form h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #555;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  background: #fafafa;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #e94560;
  background: white;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-save {
  flex: 1;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-cancel {
  flex: 1;
  background: #e5e7eb;
  color: #333;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  cursor: pointer;
}

.feedback {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #d1fae5;
  color: #065f46;
  font-size: 14px;
  white-space: pre-line;
}

/* Transaction Cards */
.recent-section {
  margin-top: 8px;
}

.recent-section h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #555;
}

.txn-card {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.txn-date {
  font-size: 13px;
  color: #888;
  width: 100%;
}

.txn-ref {
  font-size: 11px;
  color: #999;
  margin-left: 8px;
}

.txn-meta {
  width: 100%;
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.txn-corrects {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-size: 11px;
}

.txn-type {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
}

.txn-type.borrowed {
  background: #d1fae5;
  color: #065f46;
}

.txn-type.repaid {
  background: #fee2e2;
  color: #991b1b;
}

.txn-amount {
  font-size: 16px;
  font-weight: 700;
  margin-left: auto;
}

.txn-amount.borrowed {
  color: #065f46;
}

.txn-amount.repaid {
  color: #991b1b;
}

.txn-remark {
  width: 100%;
  font-size: 14px;
  color: #666;
}

.txn-actions {
  width: 100%;
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-edit, .btn-remove {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-edit {
  background: #e5e7eb;
  color: #333;
}

.btn-remove {
  background: #fee2e2;
  color: #991b1b;
}

/* Audit entries */
.audit-entry {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

.audit-timestamp {
  color: #888;
  font-size: 12px;
}

.audit-action {
  font-weight: 700;
  text-transform: uppercase;
  margin: 4px 0;
}

.audit-old {
  color: #991b1b;
}

.audit-new {
  color: #065f46;
}

/* Admin */
.admin-section {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.admin-balance {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
}

/* Year selector */
.year-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  font-size: 14px;
}

.year-bar select {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  background: #fafafa;
  -webkit-appearance: none;
}

.readonly-badge {
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.btn-export {
  background: #1a1a2e;
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}

/* Logout bar */
.logout-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.logout-bar .whoami {
  font-size: 12px;
  color: #888;
}
.logout-empty {
  flex: 1;
}
.logout-form {
  margin: 0;
}
.logout-btn {
  background: #e5e7eb;
  color: #333;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.login-box {
  max-width: 360px;
  margin: 60px auto;
  background: white;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.login-box h2 {
  font-size: 20px;
  margin-bottom: 4px;
}
.login-sub { font-size: 13px; color: #888; margin-bottom: 16px; }
.login-error {
  background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px;
  margin-bottom: 12px; font-size: 13px;
}

.overall-balance {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 8px;
}

.opening-balance {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

.overall-balance strong {
  font-weight: 700;
}

/* Transaction card status */
.txn-topline {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.txn-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
}

.txn-status.active { background: #d1fae5; color: #065f46; }
.txn-status.nullified { background: #fee2e2; color: #991b1b; }
.txn-status.reversal { background: #fef3c7; color: #92400e; }
.txn-status.correction { background: #e0e7ff; color: #4338ca; }
.txn-status.opening { background: #e5e7eb; color: #374151; }
.txn-status.removed { background: #f3f4f6; color: #6b7280; }

.edit-ref {
  font-weight: 700;
  color: #1a1a2e;
  padding: 8px;
  background: #fafafa;
  border-radius: 8px;
}

.empty-state {
  text-align: center;
  color: #888;
  padding: 32px 0;
  font-size: 14px;
}

.txn-actions .btn-remove:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  font-size: 12px;
}

/* Links */
a {
  color: #e94560;
  text-decoration: none;
}

/* Responsive */
@media (min-width: 480px) {
  .container {
    padding: 24px;
  }
  .balance-amount {
    font-size: 42px;
  }
}
