/* Finance Tracker — Defoe Elite Reset Solutions
   Mobile-first, localStorage-backed income/expense log
*/

/* ── Variables ── */
:root {
  --navy: #1a2744;
  --navy-light: #2a3d5c;
  --gold: #d4af37;
  --gold-hover: #c49f2f;
  --bg: #f4f4f4;
  --white: #ffffff;
  --text: #222;
  --text2: #555;
  --green: #1a7a4a;
  --green-bg: #d1fae5;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --border: #ddd;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Layout ── */
.container { max-width: 960px; margin: 0 auto; padding: 16px; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
h1 { color: var(--navy); font-size: 22px; }
h1 .subtitle { font-size: 13px; color: var(--text2); font-weight: normal; font-family: Arial, sans-serif; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--navy);
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background 0.15s;
}
.tab-btn:hover { background: var(--navy-light); }
.tab-btn.active { background: var(--gold); color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ── Summary Grid ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.summary-card {
  background: var(--navy);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
}
.summary-card.green { background: var(--green); }
.summary-card.red { background: var(--red); }
.summary-card .label { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.summary-card .value { font-size: 22px; font-weight: bold; }
.summary-card.gold .value { color: var(--gold); }
.summary-card .sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }

/* ── Form ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.form-grid label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 4px; font-weight: bold; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fafafa;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}
textarea { resize: vertical; min-height: 60px; }
.btn { padding: 9px 20px; border-radius: var(--radius); font-size: 14px; font-weight: bold; cursor: pointer; border: none; display: inline-block; }
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: var(--gold-hover); }
.btn-secondary { background: var(--navy); color: white; }
.btn-secondary:hover { background: var(--navy-light); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #9b1c1c; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--navy); color: white; padding: 10px 12px; text-align: left; font-size: 12px; }
td { padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9f9f9; }
.amount { font-weight: bold; }
.amount.positive { color: var(--green); }
.amount.negative { color: var(--red); }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  background: #e8f0fe;
  color: #1a56db;
}
.tag.homeaglow { background: #dbeafe; color: #1e40af; }
.tag.defoe { background: #f3e8ff; color: #6b21a8; }
.delete-btn { background: none; border: none; color: var(--red); cursor: pointer; font-size: 16px; padding: 2px 4px; }
.delete-btn:hover { color: #9b1c1c; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text2); font-size: 15px; }

/* ── Inline Form Toggle ── */
.toggle-form-btn { font-size: 13px; color: var(--gold); cursor: pointer; text-decoration: underline; margin-bottom: 12px; display: inline-block; }
.toggle-form-btn:hover { color: var(--gold-hover); }

/* ── Footer nav ── */
.topbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.topbar a { padding: 7px 14px; background: var(--navy); color: white; text-decoration: none; border-radius: var(--radius); font-size: 13px; font-weight: bold; }
.topbar a:hover { background: var(--navy-light); }
.topbar a.active { background: var(--gold); color: var(--navy); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .container { padding: 12px; }
  h1 { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  th, td { font-size: 13px; padding: 8px; }
  .amount { font-size: 13px; }
}