/* ─── Trust Fund Tracker — Custom Styles ─── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=DM+Serif+Display:wght@400&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #f4efe9;
  --surface: #fffdf9;
  --surface-alt: #f9f5ef;
  --ink: #1a1612;
  --ink-light: #6b5e52;
  --ink-muted: #a89a8c;
  --accent: #b45309;
  --accent-hover: #d97706;
  --accent-light: #fef3c7;
  --accent-dark: #92400e;
  --green: #166534;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --red: #991b1b;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --blue: #1e40af;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --purple: #6b21a8;
  --purple-bg: #faf5ff;
  --purple-border: #e9d5ff;
  --border: #e0d6cc;
  --border-light: #ede7df;
  --shadow: 0 1px 3px rgba(26,22,18,0.06), 0 1px 2px rgba(26,22,18,0.04);
  --shadow-lg: 0 4px 12px rgba(26,22,18,0.08), 0 2px 4px rgba(26,22,18,0.04);
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  margin-bottom: 0;
}

/* ─── HEADER ─── */
.header {
  background: linear-gradient(135deg, #1a1612 0%, #2d261e 50%, #3d3228 100%);
  color: #fffdf9;
  padding: 1.75rem 2rem 0;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(255,253,249,0.015) 80px, rgba(255,253,249,0.015) 81px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.header .sub {
  font-size: 0.72rem;
  color: rgba(255,253,249,0.4);
  font-weight: 300;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

/* ─── NAV ─── */
.nav-tabs-custom {
  display: flex;
  gap: 0;
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-tabs-custom .nav-tab {
  padding: 1rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,253,249,0.4);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: color 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
}

.nav-tabs-custom .nav-tab:hover {
  color: rgba(255,253,249,0.65);
  text-decoration: none;
}

.nav-tabs-custom .nav-tab.active {
  color: #fef3c7;
}

.nav-tabs-custom .nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.75rem;
  right: 0.75rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.nav-tabs-custom {
  padding-bottom: 0.5rem;
}

/* Lock icon on protected nav tabs */
.lock-icon {
  font-size: 0.55em;
  vertical-align: super;
  margin-left: 2px;
  opacity: 0.7;
}

/* ─── SUMMARY CARDS ─── */
.summary-bar {
  max-width: 1400px;
  margin: -0.75rem auto 1.75rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.75rem;
  position: relative;
  z-index: 2;
}

.s-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-lg);
}

.s-card .lbl {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.s-card .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 500;
}

.c-green { color: var(--green); }
.c-red { color: var(--red); }
.c-blue { color: var(--blue); }
.c-accent { color: var(--accent); }

/* ─── MAIN CONTAINER ─── */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

/* ─── SECTION / CARD ─── */
.section {
  margin-bottom: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.sec-hd {
  padding: 0.9rem 1.35rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-alt);
}

.sec-ico {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ico-d { background: var(--green-bg); border: 1px solid var(--green-border); }
.ico-e { background: var(--red-bg); border: 1px solid var(--red-border); }
.ico-o { background: var(--blue-bg); border: 1px solid var(--blue-border); }
.ico-u { background: var(--purple-bg); border: 1px solid var(--purple-border); }

.sec-t {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  font-weight: 400;
}

.sec-c {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--ink-muted);
  font-weight: 500;
  background: var(--bg);
  padding: 0.12rem 0.6rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.sec-add {
  margin-left: 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  border: 1px solid var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.sec-add:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ─── TABLES ─── */
.tw { overflow-x: auto; }

.section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.section thead th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.section tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.section tbody tr:hover {
  background: rgba(180,83,9,0.02);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 500;
}

.amt-p { color: var(--green); }
.amt-n { color: var(--red); }

.dt {
  color: var(--ink-light);
  white-space: nowrap;
}

.sno {
  color: var(--ink-muted);
  font-size: 0.7rem;
}

.nm { font-weight: 500; }

/* ─── BADGES ─── */
.badge-mode {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.b-cash { background: #fef3c7; color: #92400e; }
.b-upi { background: #dbeafe; color: #1e40af; }
.b-bank { background: #e0e7ff; color: #3730a3; }
.b-cheque { background: #f3e8ff; color: #6b21a8; }
.b-card { background: #fce7f3; color: #9d174d; }
.b-online { background: #d1fae5; color: #065f46; }

.b-trust {
  background: #dbeafe; color: #1e40af;
  padding: 0.1rem 0.45rem; border-radius: 4px;
  font-size: 0.63rem; font-weight: 600;
}

.b-own {
  background: #fee2e2; color: #991b1b;
  padding: 0.1rem 0.45rem; border-radius: 4px;
  font-size: 0.63rem; font-weight: 600;
}

.yes { color: var(--green); font-weight: 600; }
.no { color: var(--red); font-weight: 600; }

.rmk {
  color: var(--ink-light);
  font-style: italic;
  font-size: 0.74rem;
  max-width: 170px;
}

/* ─── WEEK SUBTOTAL & CUMULATIVE ROWS ─── */
.wk-sub td {
  background: var(--surface-alt) !important;
  border-bottom: 2px solid var(--border) !important;
  font-weight: 600;
  font-size: 0.73rem;
  color: var(--ink-light);
}

.wk-sub .mono { font-weight: 700; }

.cum td {
  background: linear-gradient(135deg, #1a1612, #2d261e) !important;
  color: #fffdf9 !important;
  font-weight: 600;
  font-size: 0.78rem;
  border-bottom: none !important;
}

.cum .mono {
  color: #fef3c7 !important;
  font-weight: 700;
}

/* ─── EMPTY STATE ─── */
.empty {
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--ink-muted);
}

.empty .ei { font-size: 2rem; margin-bottom: 0.5rem; opacity: 0.35; }
.empty p { font-size: 0.82rem; }

/* ─── FORMS ─── */
.form-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.fcard {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
}

.fcard-hd {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fcard-hd .ico {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.fcard-hd .ico.d { background: var(--green-bg); border: 1px solid var(--green-border); }
.fcard-hd .ico.e { background: var(--red-bg); border: 1px solid var(--red-border); }

.fcard-t {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
}

.fcard-body { padding: 1.35rem; }

.fg { margin-bottom: 1rem; }

.fr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.fl {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-light);
  margin-bottom: 0.3rem;
}

.fi, .fs, .ft {
  width: 100%;
  padding: 0.55rem 0.8rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.82rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fi:focus, .fs:focus, .ft:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180,83,9,0.1);
}

.ft { resize: vertical; min-height: 55px; }

.chk-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.chk-row input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

.chk-row label {
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-light);
}

.sbtn {
  width: 100%;
  padding: 0.7rem 1.5rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #fffdf9;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.4rem;
}

.sbtn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.sbtn:active { transform: translateY(0); }

.btn-cancel {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-light);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.4rem;
  text-decoration: none;
  text-align: center;
}

.btn-cancel:hover {
  background: var(--surface-alt);
  color: var(--ink);
  text-decoration: none;
}

/* Action buttons in tables */
.act-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s;
  text-decoration: none;
  font-weight: 500;
}

.act-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.act-btn.del {
  color: var(--ink-muted);
  opacity: 0.5;
}

.section tbody tr:hover .act-btn.del { opacity: 1; }

.act-btn.del:hover {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

/* ─── FOOTER ─── */
.footer-custom {
  background: linear-gradient(135deg, #1a1612, #2d261e);
  color: rgba(255,253,249,0.4);
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .header { padding: 1.25rem 1rem 0; }
  .header h1 { font-size: 1.35rem; }
  .summary-bar { padding: 0 1rem; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .main { padding: 0 1rem 2rem; }
  .form-page { padding: 1.25rem 1rem; }
  .nav-tabs-custom .nav-tab { padding: 0.65rem 0.85rem; font-size: 0.65rem; }
  .fr { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .fr { grid-template-columns: 1fr; }
  .summary-bar { grid-template-columns: 1fr; }
}

/* Transaction No - Not Available */
.txn-na { color: #a89a8c; font-style: italic; font-size: 0.8rem; }

/* Receipt links in donation tables */
.rcpt-links { white-space: nowrap; text-align: center; }
.rcpt-link {
  display: inline-block;
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  padding: 3px 8px;
  border-radius: 3px;
  color: #fff;
  letter-spacing: 0.5px;
  transition: opacity 0.15s, transform 0.1s;
  margin: 0 2px;
}
.rcpt-link:hover { opacity: 0.85; transform: translateY(-1px); }
.rcpt-pdf { background: #dc2626; }
.rcpt-png { background: #166534; }

/* Override Bootstrap defaults */
.container, .container-fluid { padding: 0; max-width: none; }
