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

body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 480px;
  margin: 0 auto;
  background: #f9fafb;
  color: #111827;
}

/* Login */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 32px 24px;
  width: 100%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.login-box h1 {
  font-size: 1.4rem;
  margin-bottom: 24px;
  text-align: center;
  color: #1d4ed8;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: #374151;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

button[type="submit"],
.btn-primary {
  width: 100%;
  padding: 12px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

button[type="submit"]:hover,
.btn-primary:hover {
  background: #1e40af;
}

.error-msg {
  color: #dc2626;
  font-size: 0.875rem;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 6px;
}

/* App shell */

#app-screen {
  min-height: 100vh;
}

#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-title {
  font-weight: 600;
  font-size: 1rem;
}

#btn-logout {
  font-size: 0.8rem;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #374151;
}

#btn-logout:hover {
  background: #f3f4f6;
}

#content {
  padding: 16px 16px 72px;
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  height: 56px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.625rem;
  color: #6b7280;
  font-family: inherit;
}

.nav-btn span {
  font-size: 0.625rem;
}

.nav-btn.active {
  color: #1d4ed8;
  font-weight: 600;
}

/* Cards */

.balance-card,
.forecast-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.balance-card.positive,
.forecast-card.positive {
  border-left: 4px solid #16a34a;
}

.balance-card.negative,
.forecast-card.negative {
  border-left: 4px solid #dc2626;
}

.balance-card .label,
.forecast-card .label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 4px;
}

.balance-card .amount,
.forecast-card .amount {
  font-size: 1.5rem;
  font-weight: 700;
}

.balance-card.positive .amount {
  color: #16a34a;
}

.balance-card.negative .amount {
  color: #dc2626;
}

.forecast-card.positive .amount {
  color: #16a34a;
}

.forecast-card.negative .amount {
  color: #dc2626;
}

.chart-container {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

/* Lists */

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

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-add {
  padding: 8px 16px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-add:hover {
  background: #1e40af;
}

.item-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-sign {
  font-size: 1.25rem;
  font-weight: 700;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.item-sign.income {
  color: #16a34a;
}

.item-sign.expense {
  color: #dc2626;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 2px;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 6px;
  color: #6b7280;
}

.btn-icon:hover {
  background: #f3f4f6;
}

.btn-icon.delete:hover {
  color: #dc2626;
  background: #fef2f2;
}

/* Form */

.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

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

.btn-save {
  flex: 1;
  padding: 11px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-save:hover {
  background: #1e40af;
}

.btn-cancel {
  flex: 1;
  padding: 11px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-cancel:hover {
  background: #e5e7eb;
}

.empty-msg {
  text-align: center;
  color: #9ca3af;
  padding: 32px 0;
  font-size: 0.95rem;
}
