/* سامانه جامع — یکدست‌سازی کادرها، دکمه‌ها و فرم‌ها (ویرایش ۴۴، بندهای ۲، ۳، ۵، ۶، ۹، ۱۰ و ۱۱)
   این پرونده آخرین سبک بارگذاری‌شده است تا قواعد پراکنده پیشین را یکدست کند:
   - همه کادرهای ورود داده (متن، عدد، تاریخ، فهرست کشویی، انتخاب فایل) یک ارتفاع، یک قلم، یک گردی و یک حالت فوکوس دارند؛
   - دکمه‌ها هم‌ارتفاع کادرها، پهنای به‌اندازه متن و بی‌شکستن متن؛
   - کادر جست‌وجو و فیلتر پهنای محدود و وسط‌چین دارد؛
   - ستون‌های جدول کوتاه یک‌خطی و متن‌های بلند متوازن می‌شکنند. */

:root {
  --ctl-h: 40px;
  --ctl-h-sm: 32px;
  --ctl-radius: 10px;
  --ctl-border: #cfd7e0;
  --ctl-bg: #fcfdfe;
  --ctl-font: 500 15px/1.5 "Vazirmatn", Tahoma, sans-serif;
  --ring: 0 0 0 3px rgba(31, 95, 139, .18);
}

/* ---------- کادرهای ورود داده ---------- */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=tel], input[type=url], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  font: var(--ctl-font); color: var(--text);
  height: var(--ctl-h); padding: 0 12px; margin: 0;
  border: 1px solid var(--ctl-border); border-radius: var(--ctl-radius); background-color: var(--ctl-bg);
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .04);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=tel], input[type=url], select, textarea { width: 100%; }
textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.9; resize: vertical; }
input:hover:not(:disabled):not([readonly]), select:hover:not(:disabled), textarea:hover:not([readonly]) { border-color: #b4c0cc; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background-color: #fff; box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: #9aa5b1; font-weight: 400; font-size: 14px; }
input[readonly], textarea[readonly], input:disabled, select:disabled { background-color: #f1f4f7; color: var(--muted); }
input[dir=ltr], input[inputmode=numeric], input[inputmode=decimal] { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
/* فهرست کشویی: پیکان یکسان سمت چپ */
select {
  appearance: none; -webkit-appearance: none; padding-left: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235c6776' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; background-size: 12px 8px;
}
select[multiple] { height: auto; background-image: none; padding: 6px 10px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; margin: 0 0 0 8px; }
label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { margin-top: 6px; }

/* ---------- انتخاب فایل (فارسی؛ fileinput.js) ---------- */
.file-pick {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--ctl-h); padding: 4px 4px 4px 12px;
  border: 1px dashed #b4c0cc; border-radius: var(--ctl-radius); background: var(--ctl-bg); cursor: pointer; margin: 0;
  color: var(--text); font-size: 14px;
}
.file-pick:hover { border-color: var(--accent); background: #f5f9fc; }
.file-pick:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.file-pick .fp-btn {
  flex: none; display: inline-flex; align-items: center; height: calc(var(--ctl-h) - 10px); padding: 0 14px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.file-pick .fp-name { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick.has-file .fp-name { color: var(--text); font-weight: 500; }
label.btn .file-pick, .barcode-photo .file-pick { display: none; }

/* ---------- دکمه‌ها: هم‌ارتفاع کادرها، پهنای به‌اندازه متن ---------- */
.btn, button:not(.link):not(.tool):not(.qs-icon) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-h); min-height: var(--ctl-h); padding: 0 16px; width: auto; max-width: 100%;
  font: 600 14px/1 "Vazirmatn", Tahoma, sans-serif; white-space: nowrap; border-radius: var(--ctl-radius);
  transition: background-color .15s, opacity .15s, box-shadow .15s;
}
.btn:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.secondary:hover, button.secondary:hover { background: var(--accent-soft); opacity: 1; }
/* دکمه‌های درون جدول و فهرست: کوچک‌تر */
td .btn, td button:not(.link), li .btn, .badge + .btn { height: var(--ctl-h-sm); min-height: var(--ctl-h-sm); padding: 0 12px; font-size: 13px; }
/* دکمه با متن بلند (مثل ورود ارکان): اجازه دو سطر */
.btn.wrap, .auth-party .btn { white-space: normal; height: auto; min-height: var(--ctl-h); padding: 8px 16px; line-height: 1.7; text-align: center; }
/* دکمه‌های پهن ناخواسته: در فرم‌های پشته‌ای هم به‌اندازه متن، مگر در گوشی */
form.stack button[type="submit"]:not(.link) { width: auto; min-width: 160px; }
@media (max-width: 600px) { form.stack button[type="submit"]:not(.link) { width: 100%; } }

/* ---------- ردیف فرم: کادر و دکمه در یک سطر، هم‌تراز و متوازن ---------- */
.row > input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .row > select, form.row label > input, form.row label > select {
  flex: 1 1 220px; width: auto; min-width: 0; max-width: 360px; }
form.row label { flex: 0 1 auto; margin: 0; }
form.row { align-items: flex-end; }
form.row > button, form.row > .btn { align-self: flex-end; }

/* ---------- جست‌وجو و فیلتر: پهنای محدود و وسط‌چین ---------- */
form[method="get"].row, form[method="get"].filters, form.row.filters, .filter-bar {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 10px 12px;
  max-width: 920px; margin: 0 auto 16px; }
form[method="get"].row > input, form[method="get"].filters > input, .filter-bar input {
  flex: 1 1 240px; max-width: 340px; width: auto; }
form[method="get"].row > select, form[method="get"].filters > select, .filter-bar select { flex: 0 1 200px; max-width: 240px; width: auto; }
form[method="get"] > div, form[method="get"] > p { margin: 0; }
.search-sheet-in { max-width: 560px; }
.qs-input { height: 36px; }

/* ---------- ثبت رسیدن مرسوله و ابزار اسکن: یک ردیف متوازن ---------- */
.receive-form > .row { justify-content: center; flex-wrap: nowrap; max-width: 620px; margin: 0 auto 10px; }
.receive-form > .row > input { max-width: none; flex: 1 1 auto; }
.barcode-buttons { justify-content: center; gap: 10px; }
.barcode-buttons > .btn, .barcode-buttons > button { min-width: 200px; }
.barcode-photo { position: relative; overflow: hidden; color: var(--accent); }
.barcode-photo input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
@media (max-width: 600px) { .receive-form > .row { flex-wrap: wrap; } .receive-form > .row > * { flex: 1 1 100%; max-width: none; }
  .barcode-buttons > * { flex: 1 1 100%; } }

/* ---------- پرداخت: دکمه پرداخت برجسته، انصراف ظریف و وسط‌چین ---------- */
.pay-step .pay-actions { flex-direction: column; align-items: center; gap: 8px; }
.pay-step .pay-actions .btn:not(.secondary) { min-width: 240px; height: 46px; font-size: 15px; }
.pay-step .pay-actions .btn.secondary { background: none; border-color: transparent; color: var(--muted); font-weight: 500; height: 32px; font-size: 13px; }
.pay-step .pay-actions .btn.secondary:hover { color: var(--bad); text-decoration: underline; background: none; }

/* ---------- جدول‌ها: سطرهای متوازن، ستون‌های کوتاه یک‌خطی ---------- */
td { text-wrap: balance; }
td p, td div { text-wrap: pretty; }
th { text-wrap: balance; white-space: normal; }
td.nowrap, td.short, th.nowrap { white-space: nowrap; }
/* ستون نوع، وضعیت و تاریخ: یک‌خطی تا وقتی جا هست */
.items-table td:nth-child(3), .items-table td:nth-child(4) { white-space: nowrap; }
@media (max-width: 600px) { .items-table td:nth-child(3), .items-table td:nth-child(4) { white-space: normal; } }

/* ---------- عنوان صفحه و دکمه‌های کنار آن ---------- */
.row > h1 + .spacer + .btn, .row > h1 ~ a.btn, .row > h1 ~ form > button { height: 36px; min-height: 36px; padding: 0 14px; font-size: 13px; }

/* ---------- صفحه ورود (بند ۱): نشان و نام صندوق وسط، «سامانه جامع» زیر آن با فاصله مناسب،
   تاریخ چپ‌چین درست بالای کادر ورود ---------- */
.auth-page .head-row { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 0; padding: 28px 16px 0; }
.auth-page .head-row > .brand { justify-self: center; }
.auth-page .brand-full { height: 110px; }
.auth-page .head-title { margin-top: 18px; font-size: 24px; }
.auth-page .head-tools { justify-self: center; width: 100%; max-width: 460px; align-items: flex-end; margin-top: 14px; }
/* ویرایش ۵۰ (بند ۵): تاریخ کمی ریزتر، هم‌عرض کادر ورود (بیرون نمی‌زند) و درست مماس بر لبه بالای کادر */
.auth-page .head-tools { max-width: 440px; margin-bottom: 0; padding: 0; }
.auth-page .head-tools .today { font-size: 12px; line-height: 1.5; margin: 0; padding: 0 6px 1px; display: block; }
.auth-page main .auth, .auth-page .auth { margin-top: 0; }
@media (max-width: 600px) { .auth-page .brand-full { height: 84px; } .auth-page .head-title { font-size: 20px; margin-top: 12px; } }
.auth-page main { padding-top: 0; margin-top: 0; }
.auth-form .auth-submit, .auth-form button[type=submit] { width: 100%; height: 44px; font-size: 15px; }

/* ---------- سربرگ گوشی: نشان و ابزارها در یک ردیف، «سامانه جامع» وسطِ ردیف دوم (بی‌هم‌پوشانی) ---------- */
@media (max-width: 600px) {
  .site-head .head-row { grid-template-columns: auto 1fr; grid-template-areas: "brand tools" "title title"; row-gap: 2px; }
  .site-head .head-row > .brand { grid-area: brand; }
  .site-head .head-row > .head-title { grid-area: title; justify-self: center; font-size: 16px; }
  .site-head .head-row > .head-tools { grid-area: tools; justify-self: end; }
  .site-head .brand-full { height: 50px; }
  .site-head .tool { width: 38px; height: 38px; }
  .site-head .tool-row { gap: 2px; }
  .auth-page .site-head .head-row { grid-template-columns: 1fr; grid-template-areas: "brand" "title" "tools"; }
  .auth-page .site-head .head-row > .head-tools { justify-self: center; }
}
.auth-page .site-head .brand-full { height: 84px; }

/* ---------- فرم‌های چندستونی و گزارش دوره‌ای ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-top: 12px; }
.form-grid > label { margin: 0; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.periodic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.periodic-grid .card { margin: 0; }
strong.bad, span.bad { color: var(--bad); }

/* راهنمای گام‌به‌گام جلسه (ویرایش ۴۶) */
.meeting-guide ol.steps { margin: 0 0 8px; padding-inline-start: 22px; }
.meeting-guide ol.steps li { padding: 4px 0; color: var(--muted); }
.meeting-guide ol.steps li.current { color: var(--text); font-weight: 600; }
.meeting-guide ol.steps li.done { color: var(--ok); }
.member-opinions { margin: 8px 0; }
.member-opinions summary { cursor: pointer; color: var(--accent); }

/* زبانه‌های یک‌سطری ارکان: در صفحه پهن همه دیده شوند (بند ۴ نکات ویرایش ۴۶)؛ در گوشی کشیدنی می‌مانند */
.tabs.one-row { gap: 4px; }
.tabs.one-row a { padding: 4px 10px; }
@media (min-width: 900px) { .tabs.one-row { overflow-x: visible; flex-wrap: wrap; } }

/* دکمه و قلم منوی با متن بلند دوسطری می‌شود، نه بریده (بند ۷ نکات ویرایش ۴۶) */
.btn, button:not(.link):not(.tool):not(.qs-icon) { white-space: normal; text-wrap: balance; height: auto; line-height: 1.45; padding-block: 7px; text-align: center; }
td .btn, td button:not(.link) { white-space: nowrap; }
.dataset-grid .btn { min-height: 48px; }
.main-nav .menu a, .main-nav details a { white-space: normal; }

/* فرم کوچک فیلتر کنار دکمه‌ها (مثل «تا پایان ماه» کنار «دریافت Excel») در یک خط (بند ۱۵ نکات ویرایش ۴۶) */
.row > form.row, .row > form { margin: 0; align-items: center; gap: 8px; }
.row > form.row { display: flex; flex-direction: row; flex-wrap: nowrap; }
.row > form.row label { margin: 0; display: inline-block; white-space: nowrap; width: auto; flex: none; }
.row > form.row select, .row > form.row input { width: auto; min-width: 120px; }
.row { align-items: center; }

/* دکمه «ورود» تمام‌عرض مانند پیش (بند ۱ نکات ویرایش ۴۶؛ قاعده عمومی دکمه‌ها نباید آن را کوتاه کند) */
form.auth-form button.auth-submit:not(.link), .auth-page form.stack > button[type=submit]:not(.link) { width: 100%; height: 44px; font-size: 15px; }

/* حساب‌های مشتریان (ویرایش ۴۷) */
.account-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.account-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); border-inline-start: 4px solid var(--accent); margin: 0; }
.account-card:hover { text-decoration: none; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.account-card.kind-facility { border-inline-start-color: var(--ok); }
.account-card.kind-managed { border-inline-start-color: var(--warn); }
.account-card.kind-margin { border-inline-start-color: var(--muted); }
.account-card .acc-title { font-size: 16px; }
.account-card .acc-number { font-variant-numeric: tabular-nums; letter-spacing: 1px; color: var(--muted); text-align: right; }
.account-card .acc-balance { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.account-card .acc-balance small { font-size: 12px; font-weight: 400; color: var(--muted); }
.positive { color: var(--ok); }

/* خطای نوع داده کنار کادر (ویرایش ۴۷) */
.field-error { display: block; color: var(--bad); font-size: 12px; margin-top: 4px; }
input[aria-invalid="true"] { border-color: var(--bad) !important; box-shadow: 0 0 0 3px var(--bad-soft); }

/* نظر اعضا در صورت‌جلسه (ویرایش ۴۹) */
.minutes .item-opinions td { border-top: 0; padding-top: 0; font-size: 13px; }
.minutes .opinion-list { margin: 4px 0; }
.minutes .opinion-list li { margin: 2px 0; }
.minutes .vote-inline { margin-top: 6px; gap: 6px; flex-wrap: wrap; }
.minutes .vote-inline input[type=text] { flex: 1 1 220px; min-width: 180px; }
.minutes .opinion-form { margin-top: 12px; }
.minutes .opinion-form textarea { width: 100%; }

/* فرم‌های یک‌خطی فیلتر: برچسب، کادر، دکمه و متن راهنما در یک امتداد (ویرایش ۵۰) */
form.row { align-items: center; }
form.row > label, form.row > .muted, form.row > span { margin-top: 0; margin-bottom: 0; align-self: center; line-height: 1.6; }
form.row > input, form.row > select, form.row > button, form.row > .btn { margin-top: 0; margin-bottom: 0; align-self: center; }

/* پایش: هر کادر با انتخاب حوزه دو نیمه می‌شود؛ راست کل صندوق، چپ همان حوزه (ویرایش ۵۱) */
.monitor-tiles .tile { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.monitor-tiles .tile-split { flex-direction: row; align-items: stretch; padding: 0; }
.monitor-tiles .tile-split .half { flex: 1 1 50%; display: grid; grid-template-rows: 2.8em auto 1.4em; align-items: center; justify-items: center; gap: 2px; padding: 12px 10px; }
.monitor-tiles .tile-split .tile-label { text-align: center; line-height: 1.4; }
.monitor-tiles .tile-split .half + .half { border-inline-start: 1px solid var(--border); }
.monitor-tiles .tile:not(.tile-split) .half { display: contents; }
.monitor-tiles .tile-sub { font-size: 11px; text-align: center; }

/* جدول ارکان ترانهاده (ویرایش ۵۱): مشخصه‌ها در سطر، اشخاص در ستون */
table.organs-t th[scope=row] { text-align: right; white-space: nowrap; background: var(--surface-2, #f4f7fa); position: sticky; right: 0; z-index: 1; }
table.organs-t thead th { min-width: 160px; text-align: center; vertical-align: bottom; }
table.organs-t td { text-align: center; min-width: 160px; }
table.organs-t td input[type=text], table.organs-t td input[type=email], table.organs-t td select { width: 100%; }
table.organs-t th.warn-col { background: var(--warn-soft, #fbf1dc); }
.organs-actions { margin-top: 12px; gap: 10px; }
.organs-reinvite { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
table.organs-t th[scope=row], table.organs-t td { vertical-align: middle; }
.error-page { max-width: 640px; margin: 24px auto; text-align: center; }
.users-grid td { min-width: 120px; } .users-grid select { min-width: 220px; }
.auth.wide-auth { max-width: 720px; }
