@font-face { font-family: Vazirmatn; src: url(/fonts/Vazirmatn-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/fonts/Vazirmatn-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/fonts/Vazirmatn-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1f2937; --muted: #6b7280; --line: #d9dee7;
  --pri: #1e4e8c; --pri2: #2f6fc0; --ok: #15803d; --warn: #b45309; --bad: #b91c1c; --soft: #eef3fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--pri2); text-decoration: none; }
input, select, textarea, button { font: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3f2; border-color: var(--pri2); }
input.ltr, .ltr { direction: ltr; text-align: left; }
input.num { width: 84px; direction: ltr; text-align: center; }
textarea { width: 100%; min-height: 70px; }
button, .btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 14px; cursor: pointer; color: var(--ink); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
button:hover, .btn:hover { background: var(--soft); }
button.pri, .btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
button.pri:hover, .btn.pri:hover { background: var(--pri2); }
button.big { padding: 10px 22px; font-weight: 700; font-size: 15px; }
button.danger { color: var(--bad); }
button.sm, .btn.sm { padding: 3px 9px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: default; }

.top { background: var(--pri); color: #fff; display: flex; align-items: center; gap: 4px; padding: 0 18px; height: 54px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.top .brand { font-weight: 700; font-size: 17px; margin-left: 22px; }
.top a { color: #dbe7f7; padding: 8px 12px; border-radius: 8px; }
.top a.on, .top a:hover { background: rgba(255,255,255,.14); color: #fff; }
.top .sp { flex: 1; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 16px 80px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card h2 .sp { flex: 1; }
h1 { font-size: 20px; margin: 4px 0 16px; display: flex; gap: 10px; align-items: center; }
h1 .sp { flex: 1; }
.grid { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > span { color: var(--muted); font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; background: var(--soft); color: var(--pri); }
.pill.ok { background: #e7f6ec; color: var(--ok); }
.pill.warn { background: #fdf1e2; color: var(--warn); }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 6px 7px; text-align: right; vertical-align: middle; }
table.t th { background: #f7f9fc; font-weight: 500; color: var(--muted); font-size: 12.5px; }
table.t tr:hover td { background: #fafcff; }
table.t td.c, table.t th.c { text-align: center; }
.scroll { overflow-x: auto; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button.on { background: var(--pri); color: #fff; border-color: var(--pri); }
.tpls { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; background: #fff; text-align: center; }
.tpl:hover { border-color: var(--pri2); background: var(--soft); }
.tpl svg { width: 100%; height: 86px; }
.tpl b { display: block; font-weight: 500; font-size: 13px; margin-top: 4px; }
.tpl .code { color: var(--muted); font-size: 11px; direction: ltr; }

.unit { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.unit .hd { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #f9fbfd; border-radius: 10px 10px 0 0; flex-wrap: wrap; }
.unit .hd b { font-weight: 500; }
.unit .bd { padding: 10px 12px; }
.params { display: grid; gap: 8px 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.params label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.params input { width: 100%; direction: ltr; text-align: center; }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: min(1100px, 100%); padding: 18px; }
.modal h3 { margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
.modal h3 .sp { flex: 1; }
.toast { position: fixed; bottom: 18px; left: 18px; background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 99; max-width: 90vw; }
.toast.bad { background: var(--bad); }
.login { max-width: 360px; margin: 12vh auto; }
.stat { display: inline-flex; flex-direction: column; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; min-width: 110px; }
.stat b { font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }
.sheetsvg { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.edge-sel { width: 70px; padding: 4px; font-size: 12px; direction: ltr; }
.formula { width: 130px; direction: ltr; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }

@media (max-width: 700px) {
  .top { height: auto; padding: 8px; }
}

/* ------------------------------------------------ print documents */
.doc-bar { background: #111827; color: #fff; padding: 10px 16px; display: flex; gap: 10px; align-items: center; position: sticky; top: 0; z-index: 5; }
.doc-bar .sp { flex: 1; }
.doc-wrap { background: #e5e7eb; padding: 20px 0; }
.page { width: 210mm; min-height: 297mm; margin: 0 auto 16px; background: #fff; padding: 9mm 8mm; position: relative; color: #1f2937; font-size: 11px; }
.page.land { width: 297mm; min-height: 210mm; }
.kx-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.kx-head .logo { font-weight: 700; font-size: 14px; color: #334155; min-width: 140px; }
.kx-title { display: inline-block; border: 1px solid #4b5563; padding: 7px 18px; font-size: 14px; }
.kx-center { text-align: center; margin: 22px 0 12px; }
table.kx { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.kx td { border: 1px solid #6b7280; padding: 6px 8px; font-size: 10.5px; }
table.kx.c td { text-align: center; }
table.kx.parts td { text-align: center; padding: 5px 4px; font-size: 10.5px; }
table.kx.parts thead td { font-size: 10.5px; }
table.kx.parts td.desc { font-size: 10px; }
.edge-ic { display: inline-block; width: 15px; height: 15px; border: 1.2px solid #374151; }
.edge-ic.le { border-left-width: 4px; } .edge-ic.re { border-right-width: 4px; }
.edge-ic.te { border-top-width: 4px; } .edge-ic.be { border-bottom-width: 4px; }
.kx-notes td { height: 70px; vertical-align: top; }
.map-title { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; border: 1px solid #6b7280; padding: 6px 10px; }
.map-list { columns: 3; font-size: 10px; margin-top: 8px; }

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .doc-bar, .noprint { display: none !important; }
  .doc-wrap { background: #fff; padding: 0; }
  .page { margin: 0; box-shadow: none; page-break-after: always; break-after: page; min-height: auto; }
  .page:last-child { page-break-after: auto; break-after: auto; }
  .page.land { page: land; }
}
@page land { size: A4 landscape; margin: 0; }
