* { box-sizing: border-box; }
body {
  font-family: 'Tahoma', 'Segoe UI', Arial, sans-serif;
  background: #f4f6f9;
  margin: 0;
  color: #26313a;
}
.topbar {
  background: #1f3b57;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: bold; }
nav a {
  color: #dbe6f0;
  text-decoration: none;
  margin-inline-start: 16px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}
nav a:hover, nav a.active { background: #2f5378; color: #fff; }
nav a.logout { background: #a5433a; color: #fff; }
.container { max-width: 1150px; margin: 24px auto; padding: 0 16px; }

.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-inline-start: 5px solid #1f3b57; }
.stat h3 { margin: 0 0 6px; font-size: 14px; color: #667; font-weight: normal; }
.stat .val { font-size: 26px; font-weight: bold; }
.stat.danger { border-color: #c0392b; }
.stat.warn { border-color: #d68910; }
.stat.good { border-color: #1e8449; }

h1, h2 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #eef2f6; font-weight: bold; }
tr:hover { background: #f9fbfd; }

.btn { display: inline-block; padding: 8px 16px; background: #1f3b57; color: #fff; border: none; border-radius: 6px; cursor: pointer; text-decoration: none; font-size: 14px; }
.btn:hover { background: #2f5378; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { background: #a5433a; }
.btn.danger:hover { background: #c0392b; }
.btn.gray { background: #7f8c8d; }

form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: bold; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #ccd3da; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.field { margin-bottom: 14px; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.badge.pending { background: #fdebd0; color: #a04000; }
.badge.paid { background: #d5f5e3; color: #196f3d; }
.badge.late { background: #fadbd8; color: #922b21; }
.badge.partial { background: #d6eaf8; color: #21618c; }
.badge.active { background: #d6eaf8; color: #21618c; }
.badge.completed { background: #d5f5e3; color: #196f3d; }
.badge.cancelled { background: #f2f3f4; color: #566573; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.success { background: #d5f5e3; color: #196f3d; }
.alert.error { background: #fadbd8; color: #922b21; }

.login-box { max-width: 380px; margin: 80px auto; background: #fff; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.filters { margin-bottom: 16px; }
.filters a { margin-inline-end: 10px; text-decoration: none; padding: 6px 14px; border-radius: 20px; background: #eef2f6; color: #333; font-size: 13px; }
.filters a.active { background: #1f3b57; color: #fff; }
.actions-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.muted { color: #888; font-size: 13px; }

.receipt h2 { font-size: 16px; margin-top: 18px; }
.receipt table th { width: 45%; background: #f7f9fb; }

@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; margin: 0; padding: 0; }
  .card { box-shadow: none; border: none; }
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 1000; padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 10px; max-width: 700px; width: 100%;
  padding: 24px; box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.inline-form { display: none; }
.inline-form.open { display: block; }
