* { box-sizing: border-box; margin: 0; }
body {
  font-family: "Nirmala UI", "Noto Sans Bengali", "Segoe UI", sans-serif;
  background: #f2f5fa; color: #1c2733; font-size: 15px;
}
header {
  background: #1F3864; color: #fff; padding: 10px 22px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.brand span { color: #9dc3ff; font-weight: 400; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
  color: #d7e3f5; text-decoration: none; padding: 6px 12px; border-radius: 7px; font-size: 14px;
}
nav a:hover { background: rgba(255,255,255,.12); }
nav a.on { background: #fff; color: #1F3864; font-weight: 600; }
main { max-width: 1180px; margin: 22px auto; padding: 0 18px 60px; }
h1 { font-size: 22px; color: #1F3864; margin-bottom: 14px; }
h1 .muted { font-size: 14px; font-weight: 400; }
h2 { font-size: 15px; color: #1F3864; margin: 22px 0 8px; }
h2.bad { color: #b3261e; }
h2.warn-t { color: #9a6b00; }
.muted { color: #7b8794; }
.bad { color: #b3261e; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.card {
  background: #fff; border-radius: 12px; padding: 16px 14px; text-decoration: none;
  color: inherit; box-shadow: 0 1px 4px rgba(16,42,84,.08); border-top: 3px solid #1F3864;
}
.card:hover { box-shadow: 0 3px 10px rgba(16,42,84,.15); }
.card .num { font-size: 26px; font-weight: 700; color: #1F3864; }
.card .lbl { font-size: 13px; color: #5d6b7a; margin-top: 2px; }
.card.alert { border-top-color: #b3261e; }
.card.alert .num { color: #b3261e; }
.card.warn { border-top-color: #d99c00; }
.card.warn .num { color: #9a6b00; }

table {
  width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px;
  overflow: hidden; box-shadow: 0 1px 4px rgba(16,42,84,.08); margin-top: 8px;
}
table.half { width: auto; min-width: 320px; }
th { background: #1F3864; color: #fff; text-align: left; padding: 8px 10px; font-size: 13px; font-weight: 600; }
td { padding: 7px 10px; border-top: 1px solid #edf1f7; vertical-align: top; }
tr:hover td { background: #f7fafd; }
td.r { text-align: right; }
tr.total td { font-weight: 700; border-top: 2px solid #1F3864; }

.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.btn {
  border: 1.5px solid #1F3864; color: #1F3864; background: #fff; border-radius: 8px;
  padding: 7px 14px; font-size: 14px; font-family: inherit; cursor: pointer; font-weight: 600;
}
.btn:hover { background: #eaf1fb; }
.btn.solid { background: #1F3864; color: #fff; margin-top: 10px; }
.btn.solid:hover { background: #2a4a80; }

#addform {
  display: none; background: #fff; border-radius: 12px; padding: 16px;
  margin: 14px 0; box-shadow: 0 1px 4px rgba(16,42,84,.08);
}
#addform.open { display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
label span { display: block; font-size: 12.5px; color: #5d6b7a; margin-bottom: 3px; }
input, select {
  width: 100%; padding: 7px 9px; border: 1px solid #c8d3e0; border-radius: 7px;
  font-family: inherit; font-size: 14px; background: #fff; color: inherit;
}
input:focus, select:focus { outline: 2px solid #9dc3ff; border-color: #1F3864; }

select.cell, input.cell { width: auto; min-width: 110px; padding: 4px 6px; font-size: 13px; }
input.cell.num { min-width: 64px; width: 64px; }
select.st-pending { background: #fff7e0; border-color: #d99c00; }
select.st-in-progress { background: #e5efff; border-color: #4d7cc7; }
select.st-done { background: #e4f5e8; border-color: #3d9a56; }
select.st-cancelled { background: #f0f1f3; color: #7b8794; }
.tag {
  background: #eaf1fb; color: #1F3864; border-radius: 6px; padding: 2px 8px;
  font-size: 12.5px; white-space: nowrap;
}

.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 12px; font-weight: 600; }
.flash.ok { background: #e4f5e8; color: #216b38; }
.flash.error { background: #fbe4e2; color: #b3261e; }

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1F3864; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: #b3261e; }

section.summary { margin-bottom: 6px; }

.logout { margin-left: auto; color: #d7e3f5; text-decoration: none; font-size: 18px; }
.logout:hover { color: #fff; }

.loginbox {
  max-width: 340px; margin: 90px auto; background: #fff; border-radius: 14px;
  padding: 30px 26px; box-shadow: 0 3px 16px rgba(16,42,84,.14); text-align: center;
}
.loginbox h1 { font-size: 26px; }
.loginbox h1 span { color: #4d7cc7; font-weight: 400; }
.loginbox form { display: grid; gap: 10px; margin-top: 16px; }

.rtabs { display: flex; gap: 6px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.rtabs a {
  text-decoration: none; color: #1F3864; padding: 6px 16px; border-radius: 20px;
  border: 1.5px solid #c8d3e0; font-size: 14px; background: #fff;
}
.rtabs a.on { background: #1F3864; color: #fff; border-color: #1F3864; font-weight: 600; }
.rtabs .datepick { margin-left: auto; }
.rtabs input[type="date"] { width: auto; }
.rnav { display: flex; align-items: center; gap: 14px; margin: 12px 0 6px; }
.rlabel { margin: 0; font-size: 18px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
tr.dim td { color: #b6bfca; }
.tag.st-done { background: #e4f5e8; color: #216b38; }
.tag.st-pending { background: #fff7e0; color: #9a6b00; }
.tag.st-in-progress { background: #e5efff; color: #2b5aa7; }
.tag.st-cancelled { background: #f0f1f3; color: #7b8794; }

@media (max-width: 640px) {
  main { padding: 0 10px 40px; }
  td, th { padding: 6px; font-size: 13px; }
  .cols2 { grid-template-columns: 1fr; }
}
@media print {
  .noprint, nav, .logout, #toast, .flash { display: none !important; }
  body { background: #fff; }
  main { max-width: none; margin: 0; }
  table { box-shadow: none; }
  .card { box-shadow: none; border: 1px solid #d5dce5; }
}

/* PHP version additions */
.userbox { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.userbox a { color: #d7e3f5; text-decoration: none; }
.userbox a:first-child { font-weight: 600; }
.rtabs { display: flex; gap: 6px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.rtabs a { text-decoration: none; color: #1F3864; padding: 6px 16px; border-radius: 20px;
  border: 1.5px solid #c8d3e0; font-size: 14px; background: #fff; }
.rtabs a.on { background: #1F3864; color: #fff; border-color: #1F3864; font-weight: 600; }
.rtabs .datepick { margin-left: auto; }
.rtabs input[type="date"] { width: auto; }
.rnav { display: flex; align-items: center; gap: 14px; margin: 12px 0 6px; }
.rlabel { margin: 0; font-size: 18px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
tr.dim td { color: #b6bfca; }
.tag.st-done { background: #e4f5e8; color: #216b38; }
.tag.st-pending { background: #fff7e0; color: #9a6b00; }
.tag.st-in-progress { background: #e5efff; color: #2b5aa7; }
.tag.st-cancelled { background: #f0f1f3; color: #7b8794; }
.btn { text-decoration: none; display: inline-block; }
th.r { text-align: right; }
@media (max-width: 640px) { .cols2 { grid-template-columns: 1fr; } }
@media print { header, .noprint { display: none !important; } }
