/* Vazirmatn served from the panel itself (Google Fonts is slow or blocked in Iran and blocked page rendering).
   Only Medium and Bold are bundled: normal text uses Medium, 600 / 700 use Bold; swap = text shows at once in Tahoma. */
@font-face { font-family: Vazirmatn; src: url("fonts/Vazirmatn-Medium.ttf") format("truetype"); font-weight: 100 500; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 600 900; font-style: normal; font-display: swap; }
:root {
  --bg: #f4f6f5; --card: #fff; --text: #1d2a24; --muted: #6b7a72; --line: #e2e8e4;
  --brand: #1f5c43; --brand-2: #e7f1ec; --warn: #fff6e5; --bad: #b42318; --ok: #0f7b4a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--brand); }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--brand); color: #fff; flex-wrap: wrap; }
.top a { color: #fff; }
.brand { font-weight: 700; font-size: 20px; }
.apps { display: flex; gap: 4px; }
.apps a { padding: 6px 14px; border-radius: 8px; text-decoration: none; opacity: .8; }
.apps a.on { background: rgba(255,255,255,.18); opacity: 1; font-weight: 600; }
.who { margin-inline-start: auto; font-size: 13px; }
/* «خروج» is a form button (POST + CSRF) that looks like the links next to it */
form.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.top .linkbtn { color: #fff; }
.wrap { display: flex; min-height: calc(100vh - 52px); }
.side { width: 220px; background: var(--card); border-inline-start: 1px solid var(--line); padding: 12px 8px; flex-shrink: 0; }
.side a { display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--text); margin-bottom: 2px; }
.side a.on { background: var(--brand-2); color: var(--brand); font-weight: 600; }
.side a.soon { color: var(--muted); cursor: default; }
.side-h { font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 12px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.side small { font-size: 11px; background: var(--line); border-radius: 6px; padding: 1px 6px; }
main { flex: 1; padding: 20px; min-width: 0; }
main.solo { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
main.embed { padding: 12px 4px; }
/* customers window of the request form */
.csearch { position: fixed; inset: 0; background: rgba(20, 30, 25, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 50; }
.csearch[hidden] { display: none; }
.csbox { width: 100%; max-width: 820px; margin: 0; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.cstable tr.link:hover td, .cstable tr.link:focus td { background: var(--brand-2); outline: none; }
/* accounting home like the Access AccMenu: four button columns, then the status panel */
.menu4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; background: #fff; border: 1px solid #DCDCDC; border-top: 0; padding: 14px; }
.menu4 .mcol { display: flex; flex-direction: column; gap: 7px; }
.menu4 .ab { display: block; text-align: center; padding: 10px 12px; }
.menu4 .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.menu4 .pair .ab { padding: 8px 6px; font-size: 13px; }
.ab.off { opacity: .45; cursor: not-allowed; }
.mstatus { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 10px; }
.mbox { background: #fff; border: 1px solid #DCDCDC; border-radius: 8px; padding: 8px 14px; }
.mrow { display: grid; grid-template-columns: 1fr auto 70px; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #EEF0EE; min-height: 40px; }
.mrow:last-child { border-bottom: 0; }
.mrow b { font-size: 16px; }
@media (max-width: 1000px) { .menu4 { grid-template-columns: 1fr 1fr; } .mstatus { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .menu4 { grid-template-columns: 1fr; } }
/* several new-request forms side by side (request_tabs.php) */
.rtabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: flex-end; border-bottom: 2px solid var(--brand); }
.rtabs .rt { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--card); cursor: pointer; font-size: 14px; }
.rtabs .rt.on { background: var(--brand); color: #fff; font-weight: 600; }
.rtabs .rt .x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; opacity: .7; }
.rtabs .rt.dirty::after { content: '•'; color: #e8a33d; font-size: 20px; line-height: 1; }
.rtabs .add { margin-bottom: 4px; }
.rframes iframe { width: 100%; height: calc(100vh - 150px); min-height: 560px; border: 0; background: var(--bg); }
.reqtop { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card.note, .card.warn { background: var(--warn); border-color: #f1dfb8; font-size: 13px; }
.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.login .logo { width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; margin: 0 auto; }
.login h1 { text-align: center; font-size: 17px; margin: 0; }
.login p { text-align: center; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
input, select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.btn { font: inherit; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; text-align: center; text-decoration: none; font-weight: 600; }
.err { color: var(--bad); font-size: 13px; }
.ok { color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 24px; color: var(--brand); }
.tile.bad b { color: var(--bad); }
.tile span { color: var(--muted); font-size: 13px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num { font-variant-numeric: tabular-nums; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--line); }
.tag.open { background: var(--brand-2); color: var(--brand); }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters .grow { flex: 1; min-width: 200px; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--brand-2); }
tr.dim td { color: var(--muted); text-decoration: line-through; }
.tag.bad { background: #fde8e6; color: var(--bad); }
h1 .tag { font-size: 13px; vertical-align: middle; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid2 > div { display: flex; flex-direction: column; gap: 2px; }
.grid2 .wide { grid-column: 1 / -1; }
.grid2 b { font-weight: 600; }
.btn.light { background: var(--brand-2); color: var(--brand); }
.okbox { background: var(--brand-2); border-color: #c6e0d3; }
.errbox { background: #fde8e6; border-color: #f5c2bc; color: var(--bad); }
.chans { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.chip:has(input:checked) { background: var(--brand-2); border-color: var(--brand); color: var(--brand); }
.form input { width: 100%; }
table.rows td { padding: 6px; }
table.rows input, table.rows select { width: 100%; min-width: 90px; }
tr.extra { display: none; }
tr.duprow td { background: var(--warn); }
.actions { display: flex; gap: 10px; margin-bottom: 30px; }
.btn.danger { background: #fde8e6; color: var(--bad); }
form.act { display: inline; margin: 0; }
.mini { font: inherit; font-size: 12px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.mini.danger { color: var(--bad); }
.rowacts { display: flex; gap: 4px; }
input.m { text-align: left; direction: ltr; min-width: 100px; }
.badtxt { color: var(--bad); font-weight: 600; }
/* forms laid out like the Access screens (header band, status line, button row, white boxes) */
.acc-form { max-width: 1240px; }
.acc-form.wide { max-width: 1400px; }
.ab.sm { padding: 6px 12px; font-size: 13px; }
tr.tot td, tr.total td, tr.net td, tr.result td { font-weight: 700; background: #F7F9F8; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs a { padding: 7px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 14px; }
.tabs a.on { background: var(--brand-2); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.chart4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chart4 > div { min-width: 0; }
.chart4 .acc-grid { max-height: 65vh; overflow: auto; }
.chart4 td { white-space: normal; }
.chart4 tr[onclick] { cursor: pointer; }
.chart4 tr.on td { background: #E2EFDA; font-weight: 600; }
@media (max-width: 1400px) { .chart4 { grid-template-columns: 1fr 1fr; } }
main { overflow-x: hidden; }
tr.head td { font-weight: 700; color: var(--brand); padding-top: 12px; }
tr.det td { color: var(--muted); font-size: 13px; }
tr.det td:nth-child(2) { padding-right: 24px; }
@media print { .top, .side, .acc-btns, form .acc-box { display: none !important; } main { padding: 0; } .acc-form { max-width: none; } }
.acc-hdr { background: #2E4A2B; color: #fff; border-radius: 10px 10px 0 0; padding: 12px 18px; }
.acc-hdr h1 { margin: 0; font-size: 19px; color: #fff; }
.acc-status { background: #fff; border: 1px solid var(--line); border-top: 0; padding: 7px 14px; font-size: 13px; min-height: 18px; color: var(--ok); }
.acc-status.err { color: var(--bad); background: #fff6f5; }
.acc-note { font-size: 12px; color: var(--muted); padding: 6px 4px 10px; }
.acc-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ab { font: inherit; font-size: 14px; font-weight: 600; color: #fff; border: 0; border-radius: 6px; padding: 8px 18px; cursor: pointer; text-decoration: none; display: inline-block; }
.ab:disabled { opacity: .45; cursor: default; }
.ab.blue { background: #2F5597; } .ab.gray { background: #595959; } .ab.green { background: #1F7A4D; }
.ab.brown { background: #7B3F00; } .ab.red { background: #A61C1C; } .ab.dgray { background: #7F7F7F; }
.acc-box { background: #fff; border: 1px solid #DCDCDC; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.acc-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin: 4px 0; }
.acc-row label, .dlg-grid label { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.acc-row .grow { flex: 1; } .acc-row .grow input { flex: 1; min-width: 320px; }
.acc-sec { font-weight: 700; margin: 12px 2px 6px; }
.acc-sec.in { margin-top: 0; }
.acc-sub { font-size: 13px; font-weight: 600; margin: 8px 0 6px; }
.acc-grid { background: #fff; border: 1px solid #DCDCDC; border-radius: 8px; margin-bottom: 10px; }
.acc-grid th { background: #F2F4F3; }
.acc-grid td { padding: 4px 8px; }
.acc-grid input, .acc-grid select { padding: 5px 7px; }
.acc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
input.ro { background: #F5F5F5; color: var(--text); }
tr.sel { cursor: pointer; } tr.sel.on td { background: #E2EFDA; }
.acc-dlg { border: 0; border-radius: 10px; padding: 0; width: min(780px, 96vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.acc-dlg::backdrop { background: rgba(0,0,0,.35); }
.acc-dlg .acc-box, .acc-dlg .acc-btns, .acc-dlg .acc-note { margin: 10px 14px; }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.dlg-grid label input, .dlg-grid label select { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .acc-split, .dlg-grid { grid-template-columns: 1fr; }
  .wrap { flex-direction: column; }
  .side { width: auto; display: flex; overflow-x: auto; border: 0; border-bottom: 1px solid var(--line); }
  .side a { white-space: nowrap; }
  main { padding: 16px; }
}

/* elements switched off by script stay hidden even inside flex rows */
[hidden] { display: none !important; }

#panel-side-menu[hidden] { display: none; }
#panel-menu-toggle { color: #fff; background: transparent; border: 1px solid currentColor; border-radius: 6px; padding: 6px 10px; font: inherit; }
