/* Agropyramid ERP — plain CSS, brand green + gold */
:root {
  --forest: #14532D; --leaf: #2E7D32; --sun: #F5B700; --sun-soft: #FFF6D6;
  --ink: #1F2A1F; --muted: #6B7563; --line: #E3E7DC; --bg: #F6F8F2; --card: #FFFFFF;
  --pos: #1B7A3A; --neg: #B42318; --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--leaf); }
h1 { font-size: 1.5rem; margin: 0; color: var(--forest); }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; color: var(--forest); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.pos { color: var(--pos); } .neg { color: var(--neg); }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--forest); color: #fff; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; padding: 4px 8px 16px; }
.brand b { color: var(--sun); }
.nav-group { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #A7C4AE; margin: 14px 8px 4px; }
.side nav a { display: block; color: #E8F1EA; text-decoration: none; padding: 7px 10px; border-radius: 8px; }
.side nav a:hover { background: rgba(255,255,255,.08); }
.side nav a.on { background: var(--sun); color: var(--forest); font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.who { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; font-size: .9rem; line-height: 1.3; }
.who a { color: var(--ink); text-decoration: none; }
.who .muted { font-size: .8rem; }
.top form { margin: 0; }
.menu-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 1rem; cursor: pointer; }
.content { padding: 24px; max-width: 1280px; width: 100%; }
.content.narrow { max-width: 640px; margin: 40px auto; }

/* Building blocks */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; justify-content: space-between; margin-bottom: 16px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.empty { text-align: center; padding: 36px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 { margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat b { font-size: 1.35rem; }
.stat small { color: var(--muted); }
.stat.alert { border-color: var(--neg); background: #FEF3F2; }
a.stat:hover { border-color: var(--leaf); }
.stats.small .stat b { font-size: 1.1rem; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FBFCF8; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #EEF1E8; color: var(--muted); }
.badge.ok { background: #E3F4E6; color: var(--pos); } .badge.bad { background: #FDE8E6; color: var(--neg); } .badge.warn { background: var(--sun-soft); color: #8A6500; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; background: #E3F4E6; color: #14532D; border: 1px solid #BFE3C6; }
.flash.error { background: #FDE8E6; color: var(--neg); border-color: #F5C2BC; }
.flash.warn { background: var(--sun-soft); color: #6B4E00; border-color: #F2DC94; }
.error { color: var(--neg); margin: 8px 0; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

/* Tables */
.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #FBFCF8; font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.table tr.dim td { opacity: .55; }
.table tr.warnrow td { background: #FFFBEB; }
.card:not(.flush) .table th, .card:not(.flush) .table td { padding-left: 0; }
.barline { height: 4px; background: #EEF1E8; border-radius: 4px; margin-top: 4px; }
.barline i { display: block; height: 100%; border-radius: 4px; background: var(--pos); }
.barline.expense i { background: #D9822B; }

/* Forms */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 2px; }
.filters label.check { flex-direction: row; align-items: center; color: var(--ink); font-size: .9rem; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #CBD3C3; border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 38px; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sun); outline-offset: 1px; border-color: var(--leaf); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; accent-color: var(--leaf); }
.form .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-weight: 500; }
.field.wide { grid-column: 1 / -1; }
.field.check, label.check { flex-direction: row; align-items: center; gap: 8px; }
fieldset.field { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }
fieldset.field legend { width: 100%; margin-bottom: 4px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.mini { width: 100px; text-align: right; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.actions.pad { padding: 14px 16px; margin: 0; border-top: 1px solid var(--line); }
.actions .push { margin-left: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--forest); background: var(--forest); color: #fff; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 38px; }
.btn:hover { background: var(--leaf); }
.btn.ghost { background: #fff; color: var(--forest); border-color: #CBD3C3; }
.btn.ghost:hover { border-color: var(--forest); }
.btn.danger { background: #fff; color: var(--neg); border-color: #F5C2BC; }
.btn.danger:hover { background: #FDE8E6; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
.btn.wide { width: 100%; }

/* Attendance P/A/H/L buttons */
.seg { display: inline-flex; border: 1px solid #CBD3C3; border-radius: 8px; overflow: hidden; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 12px; font-weight: 600; color: var(--muted); border-left: 1px solid #E3E7DC; }
.seg label:first-child span { border-left: 0; }
.seg input:focus-visible + span { outline: 2px solid var(--sun); outline-offset: -2px; }
.seg-P input:checked + span { background: var(--pos); color: #fff; }
.seg-A input:checked + span { background: var(--neg); color: #fff; }
.seg-H input:checked + span { background: #D9822B; color: #fff; }
.seg-L input:checked + span { background: #2563EB; color: #fff; }
.table td input[name^=note] { width: 100%; min-width: 140px; }

/* Sign-in */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--forest); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.auth-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.auth-head p { margin: 0; }

/* Phones */
@media (max-width: 860px) {
  .side { position: fixed; z-index: 20; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; }
  .top { padding: 8px 16px; }
  .content { padding: 16px; }
  .who .muted { display: none; }
}
@media print {
  .side, .top, .filters, .actions, .btns, .menu-btn { display: none !important; }
  .content { padding: 0; } .card { break-inside: avoid; }
}
