:root {
  --color-user1: #4A90D9;
  --color-user1-bg: #e8f0fe;
  --color-user2: #E94E77;
  --color-user2-bg: #fce4ec;
  --color-primary: #4A90D9;
  --color-danger: #E94E77;
  --color-success: #2e7d32;
  --color-success-bg: #e8f5e9;
  --color-text: #333;
  --color-text-secondary: #666;
  --color-border: #e0e0e0;
  --color-bg: #f5f7fa;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

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

/* Header */
.app-header h1 {
  font-size: 22px;
  text-align: center;
  padding: 12px 0;
}

/* Month Selector */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: white;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.month-selector select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 14px;
  background: white;
}

.nav-btn {
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.nav-btn:hover {
  background: var(--color-bg);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-hint {
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

/* Asset Cards */
.asset-cards {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.card {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}

.card-user1 {
  background: var(--color-user1-bg);
}

.card-user2 {
  background: var(--color-user2-bg);
}

.card-total {
  background: linear-gradient(135deg, var(--color-user1-bg), var(--color-user2-bg));
}

.card-label {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.card-value {
  font-size: 20px;
  font-weight: bold;
}

.card-user1 .card-value { color: var(--color-user1); }
.card-user2 .card-value { color: var(--color-user2); }

.card-entries {
  font-size: 10px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Monthly Change */
.monthly-change {
  padding: 12px;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 16px;
  font-size: 14px;
}

.monthly-change.positive {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.monthly-change.negative {
  background: #fce4ec;
  color: #c62828;
}

.monthly-change.neutral {
  background: #f5f5f5;
  color: var(--color-text-secondary);
}

/* Chart */
.chart-container {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  height: 200px;
}

/* Expenses */
.expenses-section {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.expenses-section h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.expense-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}

.expense-item:last-child {
  border-bottom: none;
}

.expense-amount {
  color: var(--color-danger);
  font-weight: bold;
}

.expense-actions {
  display: flex;
  gap: 4px;
}

.expense-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}

.no-expenses {
  color: var(--color-text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 12px 0;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}

.btn-large {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-secondary {
  background: var(--color-user2);
  color: white;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  font-size: 16px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

/* User Toggle */
.user-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.user-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.user-btn.active-user1 {
  background: var(--color-user1);
  color: white;
  border-color: var(--color-user1);
}

.user-btn.active-user2 {
  background: var(--color-user2);
  color: white;
  border-color: var(--color-user2);
}

.user-btn.completed {
  opacity: 0.7;
}

.input-month-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

/* Input Rows */
.input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.row-number {
  font-size: 13px;
  color: var(--color-text-secondary);
  min-width: 20px;
}

.input {
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 14px;
}

.input-amount {
  width: 100px;
  border-color: var(--color-user1);
  font-size: 16px;
}

.input-text {
  flex: 1;
}

.remove-row-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

.remove-row-btn:hover {
  color: var(--color-danger);
}

.add-row-btn {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--color-primary);
  background: none;
  border: 1px dashed var(--color-primary);
  border-radius: 4px;
  cursor: pointer;
  margin-top: 4px;
}

/* Add Expense Row */
.add-expense-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}

.yen-label {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.modal-expense-list {
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
}

/* Monthly Overview Modal */
.modal-wide {
  max-width: 520px;
}

.overview-year-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.overview-year-selector select {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 14px;
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.overview-table thead tr {
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
}

.overview-table th {
  padding: 8px;
  text-align: right;
  font-weight: 600;
}

.overview-table th:first-child {
  text-align: left;
}

.overview-table tbody td {
  padding: 8px;
  text-align: right;
  border-bottom: 1px solid #eee;
}

.overview-table tbody td:first-child {
  text-align: left;
}

.overview-change.positive {
  color: #2e7d32;
  font-weight: bold;
}

.overview-change.negative {
  color: #c62828;
  font-weight: bold;
}

.overview-change.neutral {
  color: var(--color-text-secondary);
}

.overview-table tbody tr.row-empty td {
  color: #ccc;
}

.overview-note {
  margin-top: 8px;
  padding: 8px;
  background: #fff3e0;
  border-radius: 4px;
  font-size: 12px;
  color: #999;
  text-align: center;
}

/* Overview Button */
.btn-overview {
  background: #6c5ce7;
  color: white;
}

/* Responsive */
@media (max-width: 400px) {
  .asset-cards {
    flex-direction: column;
  }
  .action-buttons {
    flex-direction: column;
  }
}
