* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(to bottom right, #6b21a8, #1e3a8a);
  color: white;
  min-height: 100vh;
  padding: 1rem;
}

.page { width: 100%; max-width: 900px; margin: 0 auto; }
.hidden { display: none; }

/* SETUP */
.setup-container {
  background: white;
  color: #111;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.setup-step { width: 100%; }

.input-group { margin-bottom: 1.2rem; text-align: left; }
label { font-weight: 600; display: block; margin-bottom: 0.4rem; }

input, select, button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

button {
  background: #7e22ce;
  color: white;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover { background: #6d28d9; }

/* APP */
.app-container {
  background: rgba(17, 24, 39, 0.9);
  border-radius: 16px;
  padding: 2rem;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  max-height: 90vh;
  overflow-y: auto;
}

header { margin-bottom: 2rem; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stats.no-credit {
  grid-template-columns: 1fr 1fr;
}

.stat-box {
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.stat-box.spent { background: #2563eb; }
.stat-box.left { background: #16a34a; }
.stat-box.due { background: #dc2626; }

.countdown { font-size: 1.5rem; font-weight: bold; margin-top: 0.5rem; }

/* TABS */
.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}

.tab-btn {
  background: transparent;
  color: #a78bfa;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 1rem;
  border-bottom: 3px solid transparent;
  width: auto;
  transition: all 0.2s;
}

.tab-btn.active {
  color: white;
  border-bottom-color: #7e22ce;
}

.tab-btn:hover { color: white; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* SECTIONS */
section {
  background: rgba(30, 41, 59, 0.8);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

section h2 { margin-top: 0; }

section input, section select {
  background: #1e293b;
  color: white;
  border: none;
  margin-bottom: 0.6rem;
}

.add-new-category {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.add-new-category input { flex: 1; }
.add-new-category button { width: auto; flex: 0.3; }

.item, .tx-item {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.tx-item small { color: #9ca3af; }

.delete-btn {
  background: none;
  border: none;
  color: #f87171;
  font-size: 18px;
  cursor: pointer;
}

.delete-btn:hover { color: #fca5a5; }

.insights-list { list-style: none; padding: 0; margin: 0; }
.insights-list li {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  border-left: 3px solid #8b5cf6;
}

.chart-container { height: 300px; position: relative; margin-bottom: 3rem; padding-bottom: 2rem; }

/* CHAT */
#chat-messages {
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  background: rgba(30, 41, 59, 0.5);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
}

.msg { padding: 10px 12px; border-radius: 8px; max-width: 80%; word-wrap: break-word; font-size: 0.95rem; }
.user-msg { align-self: flex-end; background: #7e22ce; color: white; }
.ai-msg { align-self: flex-start; background: rgba(139, 92, 246, 0.3); color: #e0e7ff; }

.chat-input {
  display: flex;
  gap: 8px;
}

.chat-input input {
  flex: 1;
  margin-bottom: 0;
}

.chat-input button {
  width: auto;
  flex: 0.15;
}

.example-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1rem;
}

.example-btn {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid #8b5cf6;
  color: #a78bfa;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  width: auto;
  transition: all 0.2s;
}

.example-btn:hover {
  background: rgba(139, 92, 246, 0.4);
  color: white;
}