:root {
  --ink: #1b2430;
  --muted: #5b6672;
  --line: #e1e5ea;
  --bg: #f6f7f9;
  --accent: #2f5d50;
  --accent-light: #3d7a68;
  --accent-dark: #234840;
  --accent-darker: #172f2a;
  --card-bg: #ffffff;
  --danger: #a4342a;
  --danger-light: #c04537;
  --success: #2f6f3e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef1f0 0%, var(--bg) 220px);
  background-attachment: fixed;
}

/* --- Top bar ------------------------------------------------------- */
.topbar {
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent-dark) 55%, var(--accent-darker) 100%);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18), 0 8px 20px rgba(0,0,0,0.22);
  position: relative;
  z-index: 5;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.brand-version {
  font-weight: 400;
  font-size: 0.72rem;
  opacity: 0.75;
  letter-spacing: 0.3px;
  text-shadow: none;
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  background: #ffffff;
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.12), 0 4px 10px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.6);
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.navlink {
  color: #dfe7e4;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
}
.navlink:hover {
  background: rgba(255,255,255,0.14);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 2px 6px rgba(0,0,0,0.2);
}
.navlink.active {
  background: linear-gradient(180deg, rgba(255,255,255,0.24), rgba(255,255,255,0.08));
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 2px 6px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.15);
}

.container { max-width: 1050px; margin: 0 auto; padding: 24px; }
h1 { margin-top: 0; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }
.subtitle { color: var(--muted); margin-top: -8px; }

/* --- Dashboard cards ------------------------------------------------ */
.cards { display: flex; gap: 16px; margin: 16px 0 28px; flex-wrap: wrap; }
.card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfc 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 180px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 2px 4px rgba(20,30,28,0.05), 0 8px 18px rgba(20,30,28,0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 4px 8px rgba(20,30,28,0.08), 0 14px 26px rgba(20,30,28,0.14);
}
.card-label { color: var(--muted); font-size: 0.85rem; }
.card-value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* --- Tables ---------------------------------------------------------- */
table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 3px 10px rgba(20,30,28,0.06);
}
table.table th, table.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.94rem; }
table.table thead th {
  background: linear-gradient(180deg, #f5f7f7, #e9edec);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 1px 0 rgba(0,0,0,0.04);
}
table.table tfoot th { background: linear-gradient(180deg, #eef1f1, #e5e9e8); }
table.table tbody tr:hover { background: #f6faf9; }
tr.inactive { opacity: 0.55; }

a { color: var(--accent); }

/* --- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-block;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 55%, var(--accent-dark) 100%);
  color: white !important;
  padding: 9px 18px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.12);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 2px 0 rgba(0,0,0,0.12), 0 4px 10px rgba(20,30,28,0.22);
  transition: transform 0.06s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 3px 0 rgba(0,0,0,0.12), 0 6px 14px rgba(20,30,28,0.28); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0,0,0,0.25) inset; }
.btn-secondary { background: linear-gradient(180deg, #6b7681 0%, #5b6672 55%, #454e58 100%); }
.btn-secondary:hover { filter: brightness(1.08); }
.btn-danger { background: linear-gradient(180deg, var(--danger-light) 0%, var(--danger) 55%, #7d271f 100%); }
.btn-danger:hover { filter: brightness(1.08); }

.ach-box {
  background: linear-gradient(180deg, #ffffff, #fbfcfc);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 3px 10px rgba(20,30,28,0.06);
}
.ach-box h3 { margin-top: 0; }

/* --- Status tags (invoices/bills) ----------------------------------- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}
.tag-outstanding { background: #fbe9e7; color: var(--danger); }
.tag-partially_paid { background: #fff3d6; color: #8a6100; }
.tag-paid { background: #e3f2e6; color: var(--success); }

/* --- Forms --------------------------------------------------------- */
form.form {
  background: linear-gradient(180deg, #ffffff, #fbfcfc);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  max-width: 720px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 3px 12px rgba(20,30,28,0.07);
}
form.form-inline { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; max-width: none; }
label { display: block; margin-bottom: 14px; font-size: 0.9rem; color: var(--muted); }
label input, label select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fcfdfd;
  box-shadow: inset 0 1px 3px rgba(20,30,28,0.08), inset 0 1px 0 rgba(0,0,0,0.02);
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
label input:focus, label select:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: inset 0 1px 3px rgba(20,30,28,0.10), 0 0 0 3px rgba(47,93,80,0.15);
}
label.checkbox { display: flex; align-items: center; gap: 8px; }

/* --- Account type-to-search picker (journal entry lines) ------------ */
.acct-wrap { position: relative; min-width: 220px; }
.acct-search {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fcfdfd;
  box-shadow: inset 0 1px 3px rgba(20,30,28,0.08);
}
.acct-search:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: inset 0 1px 3px rgba(20,30,28,0.10), 0 0 0 3px rgba(47,93,80,0.15);
}
.acct-suggest {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(20,30,28,0.18);
  margin-top: 2px;
}
.acct-suggest-row {
  padding: 6px 10px;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}
.acct-suggest-row:hover { background: var(--bg); }
label.checkbox input { width: auto; margin: 0; box-shadow: none; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0));
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}
legend { padding: 0 6px; color: var(--muted); font-size: 0.85rem; }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 2px 6px rgba(20,30,28,0.06);
}
.flash.success { background: #e5f3e6; color: var(--success); }
.flash.error { background: #fbe7e5; color: var(--danger); }
.flash.info { background: #e6eef5; color: #2b587e; }
.warn { color: var(--danger); font-weight: 600; }
.report-list { line-height: 2; }

/* --- Reports hub ----------------------------------------------------- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin: 12px 0 28px;
}
.report-card {
  display: block;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfc 100%);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 2px 4px rgba(20,30,28,0.05), 0 8px 18px rgba(20,30,28,0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.report-card:hover {
  transform: translateY(-2px);
  border-left-color: var(--accent-light);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 4px 8px rgba(20,30,28,0.09), 0 14px 26px rgba(20,30,28,0.15);
}
.report-card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.report-card p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.report-card-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-dark);
  background: #e8f0ed;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
  box-shadow: inset 0 1px 2px rgba(20,30,28,0.06);
}

.paystub {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  max-width: 720px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 6px 20px rgba(20,30,28,0.10);
}

@media print {
  body { background: white; }
  .topbar, .no-print { display: none !important; }
  .container { padding: 0; }
  .card, table.table, form.form, .ach-box, .paystub, .btn, .report-card { box-shadow: none !important; }
}
