:root {
  --obaara-blue: #0f172a; 
  --obaara-green: #22c55e; 
  --obaara-bg: #f8fafc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--obaara-bg);
  color: var(--obaara-blue);
  padding: 24px;
}

.container { max-width: 800px; margin: 0 auto; }

header h1 { font-size: 1.8rem; margin-bottom: 4px; }
.subtitle { color: #6b7280; margin-bottom: 24px; }

/* Alert Box */
.alert-box {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  color: #92400e;
}

/* Summary */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card .label { font-size: 0.85rem; color: #6b7280; display: block; margin-bottom: 4px; }
/* Adjusted to handle stacked currencies gracefully */
.card .value { 
  font-size: 1.25rem; 
  font-weight: 700; 
  display: flex; 
  flex-direction: column; 
  gap: 2px; 
}

/* Category Breakdown */
.breakdown-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.breakdown-section h2 { font-size: 1.1rem; margin-bottom: 12px; }
.breakdown-list { display: flex; flex-direction: column; gap: 8px; }
.breakdown-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--obaara-bg);
  border-radius: 6px;
  font-size: 0.9rem;
}
.breakdown-item strong { color: var(--obaara-blue); }

/* Form */
.add-form {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.add-form h2 { font-size: 1.1rem; margin-bottom: 12px; }
#subForm { display: flex; flex-wrap: wrap; gap: 8px; }

/* Adjusted input sizes to fit 6 fields nicely */
#subForm input, #subForm select {
  flex: 1 1 120px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
}
#subForm input[type="date"] { flex: 1 1 140px; }

#subForm button {
  flex: 1 1 100px;
  padding: 10px 20px;
  background: var(--obaara-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
#subForm button:hover { background: #16a34a; }

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
}
.filter-btn.active { background: var(--obaara-blue); color: #fff; border-color: var(--obaara-blue); }

/* List */
.sub-list { display: flex; flex-direction: column; gap: 10px; }
.sub-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-left: 4px solid var(--obaara-green);
  flex-wrap: wrap; /* Helps on mobile */
  gap: 10px;
}
.sub-item.soon { border-left-color: #f59e0b; }
.sub-item.cancelled { border-left-color: #9ca3af; opacity: 0.6; }

.sub-info h3 { font-size: 1rem; margin-bottom: 2px; }
.sub-info p { font-size: 0.85rem; color: #6b7280; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
}
.badge.soon { background: #fef3c7; color: #92400e; }
.badge.cancelled { background: #e5e7eb; color: #4b5563; }

.sub-actions { display: flex; gap: 6px; }
.sub-actions button {
  border: none;
  background: #f3f4f6;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.sub-actions button:hover { background: #e5e7eb; }
.sub-actions .delete:hover { background: #fee2e2; color: #b91c1c; }
.sub-actions .edit:hover { background: #dbeafe; color: #1e40af; }

.empty { text-align: center; color: #9ca3af; padding: 40px; }

/* Mobile Adjustments */
@media (max-width: 600px) {
  .summary { grid-template-columns: 1fr; }
  .card .value { font-size: 1.4rem; }
  .sub-item { flex-direction: column; align-items: flex-start; }
  .sub-actions { width: 100%; justify-content: flex-end; }
}