@font-face { font-family: V; src: url(fonts/Vazirmatn-FD-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: V; src: url(fonts/Vazirmatn-FD-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: V; src: url(fonts/Vazirmatn-FD-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --m: #7b1e2e; --m2: #5a1522; --mt: #f6eff0; --mt2: #ecdde0;
  --ink: #1f1d1e; --q: #6b6567; --line: #e3dadc; --bg: #f7f4f4; --card: #fff;
  --ok: #2f7d4f; --okt: #e6f3eb; --warn: #9a6a00; --warnt: #fbf3df; --err: #b42318; --errt: #fde9e7;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: V, Tahoma, sans-serif; background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.75; display: flex; min-height: 100vh; }
a { color: var(--m); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--q); font-size: .92em; }

/* sidebar */
.side { width: 250px; flex: 0 0 250px; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px 16px; border-bottom: 1px solid var(--line); }
.brand img { width: 120px; }
.brand span { font-weight: 700; color: var(--m); font-size: 14px; }
.brand:hover { text-decoration: none; }
.side nav { flex: 1; overflow: auto; padding: 10px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--ink); margin-bottom: 2px; }
.side nav a i { font-style: normal; width: 18px; text-align: center; color: var(--q); }
.side nav a:hover { background: var(--mt); text-decoration: none; }
.side nav a.on { background: var(--m); color: #fff; }
.side nav a.on i { color: #fff; }
.me { border-top: 1px solid var(--line); padding: 12px 16px; font-size: 12.5px; }
.me b { display: block; font-size: 14px; }
.me span { display: block; color: var(--q); margin-bottom: 4px; }

main { flex: 1; min-width: 0; padding: 0 28px 48px; }
.top { display: flex; align-items: center; gap: 16px; padding: 22px 0 14px; }
.top > div { flex: 1; }
.top .firm { font-size: 12.5px; color: var(--m); font-weight: 500; }
.top h1 { margin: 0; font-size: 22px; line-height: 1.4; }
.top .menu { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; }

/* cards, grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; }
.card > h2, .card > h3 { margin: 0 0 10px; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.empty { color: var(--q); padding: 10px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
label.row { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 4px; }
label.row input { margin-top: 7px; flex: 0 0 auto; }

/* buttons, badges, flash */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--m); color: #fff; border: 1px solid var(--m); border-radius: 8px; padding: 7px 16px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--m2); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--m); border-color: var(--mt2); }
.btn.ghost:hover { background: var(--mt); }
.btn.sm { padding: 3px 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.badge.gray { background: #eeeaeb; color: #555; } .badge.amber { background: var(--warnt); color: var(--warn); }
.badge.green { background: var(--okt); color: var(--ok); } .badge.red { background: var(--errt); color: var(--err); }
.flash { border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--okt); border-color: #bfe0cb; color: #1d5a37; }
.flash.err { background: var(--errt); border-color: #f5c2bd; color: #8f1d14; }
.flash.warn { background: var(--warnt); border-color: #efdcae; color: #6e4c00; }

/* lists */
.tw { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: right; font-weight: 500; color: var(--q); font-size: 13px; border-bottom: 1px solid var(--line); padding: 7px 8px; white-space: nowrap; }
table.list td { border-bottom: 1px solid #f0eaeb; padding: 8px; vertical-align: top; }
table.list tr:hover td { background: #fcfafa; }

/* inbox */
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li { border-bottom: 1px solid #f0eaeb; }
.inbox li a { display: flex; gap: 10px; padding: 9px 4px; color: var(--ink); }
.inbox li a:hover { background: #fcfafa; text-decoration: none; }
.inbox .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 9px; flex: 0 0 9px; background: var(--q); }
.inbox .urgent .dot { background: var(--err); } .inbox .sign .dot { background: var(--m); }
.inbox .go .dot { background: var(--ok); } .inbox .warn .dot { background: #d29a00; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: #fff; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.3; }
.kpi .l { font-size: 13px; }
.kpi .s { font-size: 12px; color: var(--q); }
.kpi.good .v { color: var(--ok); } .kpi.bad .v { color: var(--err); } .kpi.na .v { color: #bbb; }

/* stepper */
.stepper { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 6px 0 14px; }
.stepper div { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; text-align: center; background: #fff; color: var(--q); }
.stepper .done { background: var(--mt); color: var(--m); border-color: var(--mt2); }
.stepper .cur { background: var(--m); color: #fff; border-color: var(--m); font-weight: 700; }
.gates { list-style: none; padding: 0; margin: 0 0 12px; }
.gates li { padding: 4px 0; display: flex; gap: 8px; }
.gates li b { width: 20px; flex: 0 0 20px; text-align: center; }
.gates .y b { color: var(--ok); } .gates .n b { color: var(--err); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 8px 8px 0 0; color: var(--q); border: 1px solid transparent; margin-bottom: -1px; }
.tabs a.on { background: #fff; border-color: var(--line); border-bottom-color: #fff; color: var(--m); font-weight: 700; }
.tabs a:hover { text-decoration: none; color: var(--m); }

/* forms (generic) */
.form .fld { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.form .fld > span { font-size: 13px; color: var(--q); }
.form input[type=text], .form input[type=password], .form input[type=number], .form input:not([type]), .form select, .form textarea,
.inline input, .inline select, .inline textarea {
  border: 1px solid #d9cfd1; border-radius: 7px; padding: 6px 10px; background: #fff; width: 100%; min-width: 0; }
.form input:focus, .form select:focus, .form textarea:focus, .inline input:focus, .inline select:focus { outline: 2px solid var(--mt2); border-color: var(--m); }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline label { display: flex; flex-direction: column; font-size: 13px; color: var(--q); gap: 3px; flex: 1; min-width: 150px; }
.inline label.chk { flex-direction: row; align-items: center; min-width: 0; flex: 0 0 auto; color: var(--ink); }
.inline label.chk input { width: auto; }

/* form records */
.rhead { display: flex; gap: 16px; align-items: center; }
.rcode { background: var(--m); color: #fff; font-weight: 700; padding: 10px 14px; border-radius: 8px; direction: ltr; white-space: nowrap; }
.rinfo { flex: 1; }
.fh { color: var(--m); font-size: 15px; border-bottom: 1px solid var(--mt2); padding-bottom: 4px; margin: 18px 0 10px; }
.fnote { background: var(--mt); border-right: 3px solid var(--m); padding: 8px 12px; border-radius: 6px; font-size: 13.5px; margin: 8px 0 12px; }
.fgrid { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: 4px 16px; margin: 6px 0 10px; }
.fgrid .fld b { font-weight: 500; min-height: 1.6em; border-bottom: 1px dotted #c9bcbf; display: block; }
.fchoice { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin: 8px 0 12px; }
.fchoice .cl { font-weight: 700; }
.fchoice .opt { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.fchoice .opt.clear { color: var(--q); font-size: 12.5px; }
.fchoice .opt i { width: 14px; height: 14px; border: 1.5px solid #888; border-radius: 3px; display: inline-block; }
.fchoice .opt.on i { background: var(--m); border-color: var(--m); box-shadow: inset 0 0 0 2px #fff; }
.fchoice .opt.off { color: var(--q); }
.tcap { font-weight: 700; margin: 12px 0 4px; }
table.ft { width: 100%; border-collapse: collapse; margin-bottom: 10px; font-size: 13.5px; }
table.ft th { background: var(--mt); color: var(--m); font-weight: 700; border: 1px solid var(--line); padding: 5px 6px; text-align: center; font-size: 12.5px; }
table.ft td { border: 1px solid var(--line); padding: 4px 6px; vertical-align: middle; }
table.ft td.c { text-align: center; }
table.ft td.n { text-align: center; color: var(--q); width: 40px; }
table.ft td.fixed { background: #fbf8f8; font-weight: 500; }
table.ft td input[type=text] { border: 0; padding: 3px 4px; background: transparent; width: 100%; }
table.ft td input[type=text]:focus { outline: 2px solid var(--mt2); background: #fff; }
.w5 { width: 44px; } .w7 { width: 58px; } .w12 { width: 110px; } .w25 { width: 24%; }
.tick { color: var(--m); font-weight: 700; }
.ftext { display: block; margin: 8px 0 12px; }
.ftext > span { display: block; font-size: 13px; color: var(--q); margin-bottom: 3px; }
.ftext textarea { width: 100%; border: 1px solid #d9cfd1; border-radius: 7px; padding: 6px 10px; resize: vertical; }
.tv { border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; background: #fdfcfc; }
.blank { color: #ccc; }
.letter p { margin: 0 0 8px; line-height: 2.1; text-align: justify; }
.letter input.inl { border: 0; border-bottom: 1px solid #b9aaad; border-radius: 0; width: 220px; padding: 0 4px; background: transparent; }
.letter u.inl { text-decoration: none; border-bottom: 1px dotted #888; padding: 0 4px; }
.signs { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 16px; }
.sig { flex: 1 1 200px; border: 1px dashed #cbbcbf; border-radius: 9px; padding: 10px 12px; background: #fdfbfb; }
.sig .sr { font-weight: 700; color: var(--m); font-size: 13.5px; }
.sig .sn { font-weight: 700; }
.sig .sd { font-size: 12.5px; color: var(--q); margin-bottom: 6px; }
.sig.done { border-style: solid; border-color: #bfe0cb; background: var(--okt); }
.sig.done .sr { color: var(--ok); }
.sig.opt { opacity: .6; }
.sig .why { font-size: 12px; color: var(--err); }
.savebar { position: sticky; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); margin: 16px -20px -18px; padding: 10px 20px; display: flex; gap: 12px; align-items: center; border-radius: 0 0 var(--r) var(--r); }

/* lifecycle (manual) */
.lifecycle { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 10px 0 16px; }
.lifecycle .lc { border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; background: #fff; }
.lifecycle .lc b { display: block; font-size: 13px; }
.lifecycle .lc span { font-size: 11.5px; color: var(--q); }
.lifecycle .lc.last { border: 2px solid var(--m); background: var(--mt); }
.manualwrap { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.mtoc { position: sticky; top: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; font-size: 13px; }
.mtoc a { padding: 3px 6px; border-radius: 6px; color: var(--ink); }
.mtoc a:hover { background: var(--mt); text-decoration: none; }
.manual h2 { color: var(--m); border-bottom: 2px solid var(--m); padding-bottom: 4px; margin-top: 34px; font-size: 19px; }
.manual h3 { color: var(--m); font-size: 15.5px; margin-top: 20px; }
.manual table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0 14px; }
.manual th { background: var(--m); color: #fff; padding: 6px 8px; text-align: right; font-weight: 500; }
.manual td { border: 1px solid var(--line); padding: 5px 8px; vertical-align: top; }
.manual tr:nth-child(even) td { background: #fbf8f8; }

/* auth */
body.auth { align-items: center; justify-content: center; background: linear-gradient(160deg, #fff 0%, var(--mt) 100%); }
.authbox { width: 380px; max-width: 92vw; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; text-align: center; box-shadow: 0 10px 40px rgba(123,30,46,.08); }
.authbox.wide { width: 520px; text-align: right; margin: 30px auto; }
.authbox img { width: 150px; display: block; margin: 0 auto 8px; }
.authbox h1 { font-size: 20px; margin: 6px 0 2px; text-align: center; }
.authbox .form { text-align: right; margin-top: 18px; }
.authbox .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* print view */
body.printing { display: block; background: #e9e5e6; }
.ptools { text-align: center; padding: 14px; }
.paper { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto 30px; padding: 12mm 13mm; box-shadow: 0 2px 16px rgba(0,0,0,.1); font-size: 12.5px; }
.paper.land { width: 297mm; min-height: 210mm; }
.phead { display: flex; align-items: stretch; border: 1.5px solid var(--m); border-radius: 6px; margin-bottom: 10px; }
.phead img { height: 54px; align-self: center; margin: 0 12px; }
.phead .pt { flex: 1; padding: 8px 4px; }
.phead .pt .firm { color: var(--m); font-weight: 700; font-size: 12px; }
.phead .pt h1 { margin: 0; font-size: 18px; }
.pmeta { width: 190px; border-right: 1.5px solid var(--m); font-size: 11.5px; }
.pmeta div { display: flex; justify-content: space-between; padding: 3px 8px; border-bottom: 1px solid var(--mt2); }
.pmeta div:last-child { border-bottom: 0; }
.pmeta .code { background: var(--m); color: #fff; justify-content: center; font-weight: 700; font-size: 15px; direction: ltr; }
.pfoot { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; font-size: 10.5px; color: var(--q); }
.print .fh { margin-top: 10px; }
.print table.ft { font-size: 12px; }
.print .sig { background: #fff; border-style: solid; }
.print .sig.done { background: #fff; border-color: var(--line); }
.print .sig.done .sr { color: var(--m); }
.sline { border-bottom: 1px dotted #888; height: 22px; font-size: 11px; color: var(--q); }
.pb { height: 0; }
@media print {
  @page { size: A4; margin: 10mm; }
  body.printing.land { }
  body.printing { background: #fff; }
  .ptools { display: none; }
  .paper { box-shadow: none; margin: 0; width: auto; min-height: 0; padding: 0; }
  .pb { break-before: page; }
  tr, .sig, .fnote { break-inside: avoid; }
}

/* responsive */
@media (max-width: 900px) {
  .side { position: fixed; right: -270px; z-index: 20; transition: right .2s; box-shadow: 0 0 30px rgba(0,0,0,.15); }
  body.nav-open .side { right: 0; }
  .top .menu { display: block; }
  main { padding: 0 14px 40px; }
  .grid2, .grid3, .manualwrap { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr 1fr; }
  .stepper, .lifecycle { grid-template-columns: repeat(4, 1fr); }
  .mtoc { position: static; }
}
@media (max-width: 560px) { .fgrid { grid-template-columns: 1fr; } .stepper, .lifecycle { grid-template-columns: repeat(2, 1fr); } }

/* ---- lite additions ---- */
.badge.blue { background: #e8f0fb; color: #1f4f8f; } .badge.dark { background: #2b2628; color: #fff; }
.stepper { grid-template-columns: repeat(6, 1fr); }
.stepper a { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; text-align: center; background: #fff; color: var(--q); }
.stepper a.done { background: var(--mt); color: var(--m); border-color: var(--mt2); }
.stepper a:hover { text-decoration: none; border-color: var(--m); }
.now { border-right: 4px solid var(--m); }
.now h2 { color: var(--m); }
.point { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.point.open { border-right: 4px solid var(--err); } .point.answered { border-right: 4px solid #d29a00; } .point.accepted { border-right: 4px solid var(--ok); background: #fbfdfb; }
.point .ph { margin-bottom: 6px; }
.thread { list-style: none; margin: 0 0 8px; padding: 0 12px 0 0; border-right: 2px solid var(--line); }
.thread li { padding: 4px 0 6px; }
.thread .tm { font-size: 12px; color: var(--q); }
.thread li.answered .tm { color: #8a6100; } .thread li.accepted .tm { color: var(--ok); } .thread li.rejected .tm { color: var(--err); }
.point form { margin-top: 6px; }
.point form.inline .btn { margin-bottom: 1px; }
details summary { cursor: pointer; }
table.kv { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 12.5px; }
table.kv th { background: var(--mt); color: var(--m); text-align: right; font-weight: 500; padding: 4px 8px; border: 1px solid var(--line); width: 16%; }
table.kv td { border: 1px solid var(--line); padding: 4px 8px; }
.point.print { break-inside: avoid; }
@media (max-width: 900px) { .stepper { grid-template-columns: repeat(3, 1fr); } }

/* ---- questionnaire ---- */
table.ft td.hl, table.ft th.hl { background: var(--mt); font-weight: 700; color: var(--m); }
table.ft td.bad input { outline: 2px solid var(--err); background: var(--errt); }
table.q tr.qh td { background: #efe6e8; font-weight: 700; color: var(--m); }
table.q tr.qh2 td, table.q tr.qp td { font-weight: 700; background: #faf6f7; }
table.q tr.qi.na td { color: #aaa; }
table.q tr.qsub td { font-size: 12.5px; padding-right: 26px; background: #fdfcfc; }
table.q tr.qsub.qt td { font-weight: 700; color: var(--m); }
table.q tr.qn td { color: var(--q); }
table.q tr.qt td { background: var(--mt); font-weight: 700; }
table.q .ql { color: var(--m); font-weight: 700; white-space: nowrap; }
table.q .mk { color: var(--ok); font-weight: 700; }
table.ft input.num { text-align: center; }
table.ft input:disabled { color: var(--ink); }
.blankrow { display: flex; align-items: center; gap: 6px; } .blankrow input[type=text] { border-bottom: 1px dotted #aaa !important; }
.form input:disabled, .form select:disabled, .form textarea:disabled { background: #faf8f8; color: var(--ink); }
.grp { margin: 0 0 8px; font-size: 12.5px; } .grp .opt { margin-left: 14px; display: inline-flex; gap: 4px; align-items: center; }
.grp .opt i { width: 12px; height: 12px; border: 1.5px solid #777; border-radius: 2px; display: inline-block; } .grp .opt.on i { background: var(--m); border-color: var(--m); }
table.kv th[rowspan] { width: 18%; text-align: center; }
.boxline { border: 1px solid var(--line); padding: 5px 8px; margin: 6px 0 10px; font-weight: 500; font-size: 12.5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foot { font-size: 11px; color: var(--q); margin: 6px 0; }
ul.bl { margin: 4px 0; padding-right: 18px; columns: 2; font-size: 12px; }
.paper + .paper { margin-top: 20px; }
@media print { .paper { break-after: page; } .paper:last-child { break-after: auto; } table.ft input { border: 0; } }

.two { align-items: start; }
.paper table.ft td { padding: 2px 6px; }
.paper table.kv td, .paper table.kv th { padding: 3px 8px; }
.paper table.q { margin-bottom: 4px; }
.paper table.q thead { display: table-header-group; }
@media print { .paper table.q tr { break-inside: avoid; } }

.sg { font-size: 11.5px; margin-top: 3px; line-height: 1.5; white-space: nowrap; }
.sg b { color: var(--m); }
.sg .btn.sm { padding: 0 8px; font-size: 11.5px; margin-right: 2px; }
