/* ─── Variables ──────────────────────────────────────────────────── */
:root {
  --black:      #0D0D0D;
  --black-2:    #141414;
  --black-3:    #1C1C1C;
  --black-4:    #252525;
  --black-5:    #2E2E2E;
  --gold:       #D4AF37;
  --gold-light: #E8CC6A;
  --gold-dark:  #A88920;
  --green:      #2E7D32;
  --green-light:#43A047;
  --green-dark: #1B5E20;
  --red:        #C62828;
  --red-light:  #EF5350;
  --text:       #E8E8E8;
  --text-muted: #888888;
  --border:     #2E2E2E;
  --radius:     8px;
  --shadow:     0 4px 16px rgba(0,0,0,0.4);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--black);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ─── Navbar ─────────────────────────────────────────────────────── */
.navbar {
  background: var(--black-2);
  border-bottom: 1px solid var(--gold-dark);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.nav-logo { font-size: 1.4rem; }
.nav-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  margin-left: 1.5rem;
  flex: 1;
}
.nav-links a {
  display: block;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--black-4);
  color: var(--gold);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.user-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--black-4);
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
}
.btn-icon {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--black-4); color: var(--gold); }

.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }

/* ─── Main ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ─── Flash ──────────────────────────────────────────────────────── */
.flash-container { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: opacity 0.5s;
}
.flash-success { background: #1B5E2033; border: 1px solid var(--green); color: var(--green-light); }
.flash-error   { background: #C6282833; border: 1px solid var(--red); color: var(--red-light); }

/* ─── Page header ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn-primary  { background: var(--gold);  color: var(--black); }
.btn-gold     { background: var(--gold-dark); color: var(--black); }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-sm       { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-block    { width: 100%; }
.btn-group    { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ─── Filter bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.filter-group { display: flex; flex-direction: column; gap: 0.35rem; }
.filter-group label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Stat cards ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.stat-card-warn { border-color: var(--red); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-value.gold { color: var(--gold); }

/* ─── Charts ─────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.chart-card {
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.chart-title { font-size: 0.95rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1rem; }
.chart-wrap  { position: relative; height: 240px; }

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 1.5rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--black-3);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--black-3); }
.clickable-row { cursor: pointer; }
.text-right { text-align: right; }
.muted { color: var(--text-muted); }
.muted-table td { color: var(--text-muted); }
.date-cell { white-space: nowrap; color: var(--text-muted); font-size: 0.85rem; }
.amount-cell { color: var(--gold); font-weight: 600; }

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  background: var(--black-4);
  font-size: 0.8rem;
  white-space: nowrap;
}
.badge-gold  { background: #D4AF3722; color: var(--gold); border: 1px solid var(--gold-dark); }
.badge-green { background: #2E7D3222; color: var(--green-light); border: 1px solid var(--green); }
.badge-red   { background: #C6282822; color: var(--red-light); border: 1px solid var(--red); }

/* ─── Section labels ─────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.section-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.section-label { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.75rem; }
.link-muted { font-size: 0.85rem; color: var(--text-muted); }
.link-muted:hover { color: var(--gold); }

/* ─── Forms ──────────────────────────────────────────────────────── */
input[type="text"], input[type="number"], input[type="password"],
input[type="url"], input[type="date"], input[type="email"],
select, textarea {
  background: var(--black-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input:disabled { opacity: 0.5; cursor: not-allowed; }
select option { background: var(--black-3); }
textarea { resize: vertical; }

.form-card {
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 800px;
}
.form-card-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1.25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-full { grid-column: 1 / -1; }
label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.inline-form { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }

/* ─── Detail card ────────────────────────────────────────────────── */
.detail-card {
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.detail-amount {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 0.25rem;
}
.detail-amount.green { color: var(--green-light); }
.detail-sub { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.detail-desc { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.detail-item { display: flex; flex-direction: column; gap: 0.3rem; }
.detail-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.detail-value { font-size: 0.95rem; }

/* ─── Progress bar ───────────────────────────────────────────────── */
.progress-wrap { margin: 1rem 0; }
.progress-bar { background: var(--black-4); border-radius: 99px; height: 8px; overflow: hidden; margin-bottom: 0.35rem; }
.progress-fill { background: linear-gradient(90deg, var(--green), var(--gold)); height: 100%; border-radius: 99px; transition: width 0.4s; }
.progress-label { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Danger zone ────────────────────────────────────────────────── */
.danger-zone {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Pagination ─────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 1rem; justify-content: center; padding: 1rem 0; }
.page-info { font-size: 0.85rem; color: var(--text-muted); }

/* ─── Count badge ────────────────────────────────────────────────── */
.count-badge {
  display: inline-block;
  background: var(--black-4);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ─── Receipt link ───────────────────────────────────────────────── */
.receipt-link {
  color: var(--green-light);
  font-size: 0.85rem;
}
.receipt-link:hover { color: var(--gold); }

/* ─── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
  font-size: 0.95rem;
}

/* ─── Update banner ──────────────────────────────────────────────── */
.update-banner {
  background: var(--black-3);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--gold);
}

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
}
.modal-card {
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.modal-card h3 { color: var(--gold); font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ─── Login ──────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--black);
}
.login-card {
  background: var(--black-2);
  border: 1px solid var(--gold-dark);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.login-title { font-size: 1.6rem; font-weight: 800; color: var(--gold); margin-bottom: 0.25rem; }
.login-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.75rem; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 1rem; }

/* ─── Footer ─────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--black-2); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .main-content { padding: 1rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-group { width: 100%; }
  .filter-group select, .filter-group input { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; }
  .user-badge { display: none; }
}
