/* حسابات الكتيبة — inherits K697 Command System (steel blue) */
body.theme-battalion .sidebar-brand-icon {
  box-shadow: 0 0 24px rgba(94, 176, 232, 0.32), 0 0 0 1px rgba(94, 176, 232, 0.4);
}

/* التنبيهات نصها فقرات مش أعمدة — flex بيقسّم النص عند كل <strong> */
body.theme-battalion .alert { display: block; }

.avail-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}
.avail-mini-col { min-width: 0; }
.avail-mini.mini-list { grid-template-columns: 1fr; gap: 3px; }
.avail-mini-row.mini-total,
.avail-mini-row.mini-total b {
  color: var(--primary-dark, #0b2a44);
  font-size: 12px;
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}
.avail-mini-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
}
.avail-mini-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avail-mini-row b {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 800;
}
.avail-mini-row.plus,
.avail-mini-row.plus b { color: #166534; }
.avail-mini-row.minus,
.avail-mini-row.minus b { color: #991b1b; }

.formula-note {
  margin: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: #334155;
  font-weight: 700;
}

@media (max-width: 900px) {
  .avail-mini {
    grid-template-columns: 1fr;
    gap: 2px;
    font-size: 10.5px;
  }
  .formula-note { font-size: 12.5px; line-height: 1.7; }

  .voucher-cart table,
  .voucher-cart thead,
  .voucher-cart tbody,
  .voucher-cart tr,
  .voucher-cart th,
  .voucher-cart td {
    display: block;
    width: 100%;
  }
  .voucher-cart thead { display: none; }
  .voucher-cart tr.voucher-line {
    padding: 12px;
    border-bottom: 8px solid #f0fdf4;
  }
  .voucher-cart td {
    padding: 6px 0;
    border: none;
  }
  .voucher-cart td::before {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 4px;
  }
  .voucher-cart td:nth-child(2)::before { content: "رقم البون"; }
  .voucher-cart td:nth-child(3)::before { content: "التاريخ"; }
  .voucher-cart td:nth-child(4)::before { content: "المستفيد"; }
  .voucher-cart td:nth-child(5)::before { content: "البيان / الغرض"; }
  .voucher-cart td:nth-child(6)::before { content: "المبلغ"; }
  .voucher-cart td:nth-child(7)::before { content: "ملاحظات"; }
  .voucher-cart .voucher-line-idx::before,
  .voucher-cart .voucher-line-act::before,
  .voucher-cart td:last-child::before { display: none; }
  .voucher-cart .voucher-line-idx {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
  }
  .voucher-cart .voucher-line-act .btn { width: 100%; }
  .voucher-cart .field {
    min-height: 44px;
    font-size: 16px !important;
  }
  .voucher-batch-foot .btn { width: 100%; }
}

/* ─── Mobile: battalion layout tuning ─── */
@media (max-width: 900px) {
  /* عمودين بعرض متاح فعلًا من غير أي حد أدنى يسبب تمدد أفقي */
  body.theme-battalion .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
  }
  /* الكروت اللي فيها تفصيل/قائمة أو زر عريض تاخد الصف كله */
  body.theme-battalion .stats-grid > .stat-card-wide { grid-column: 1 / -1; }
  body.theme-battalion .stat-card-wide .stat-value { font-size: 24px; }
  body.theme-battalion .stat-card-wide .avail-mini { grid-template-columns: 1fr; }

  body.theme-battalion .avail-mini-row { gap: 10px; }
  body.theme-battalion .avail-mini-row span {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.5;
  }

  /* جداول بيان/قيمة: سطر مضغوط لكل بند بدل كارت كبير لكل سطر */
  body.theme-battalion table.data-table.table-kv tbody tr {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 9px 4px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body.theme-battalion table.data-table.table-kv tbody tr:first-child {
    border-top: 1px solid var(--border);
  }
  body.theme-battalion table.data-table.table-kv tbody tr:last-child { border-bottom: 0; }
  body.theme-battalion table.data-table.table-kv tbody td,
  body.theme-battalion table.data-table.table-kv tbody td.is-title {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.65;
    text-align: start;
  }
  body.theme-battalion table.data-table.table-kv tbody td::before { display: none; }
  body.theme-battalion table.data-table.table-kv tbody td + td {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: left;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }
  body.theme-battalion table.data-table.table-kv tbody td.is-span {
    display: block;
    width: 100%;
    padding: 6px 0;
    text-align: center;
  }

  /* خلية ملخص الشهر تاخد العرض كله بدل ما تتكدس جنب ليبل */
  body.theme-battalion table.data-table tbody td.is-summary {
    display: block;
    padding-top: 8px;
  }
  body.theme-battalion table.data-table tbody td.is-summary::before {
    display: block;
    flex: none;
    max-width: none;
    margin-bottom: 3px;
  }

  /* صندوق الترحيل في صفحة التقفيل */
  body.theme-battalion .carry-box { padding: 12px; }
  body.theme-battalion .carry-item {
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.6;
  }
  body.theme-battalion .carry-item input[type=checkbox] {
    width: 20px;
    height: 20px;
    margin-top: 1px;
  }
  body.theme-battalion .carry-item b { margin-right: auto; white-space: nowrap; }
  body.theme-battalion .carry-target { flex-direction: column; align-items: stretch; }
  body.theme-battalion .carry-target select { min-width: 0; width: 100%; }
  body.theme-battalion .carry-new { flex-direction: column; align-items: stretch; }
  body.theme-battalion .carry-new input[type=date],
  body.theme-battalion .carry-new input[type=text] { min-width: 0; width: 100%; }
  body.theme-battalion .carry-activate { width: 100%; min-height: 40px; }

  body.theme-battalion table.data-table input[type=checkbox] {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 520px) {
  body.theme-battalion .card { padding: 14px 10px; }
  body.theme-battalion .stats-grid { gap: 8px; }
  body.theme-battalion .stat-card { padding: 11px 10px 10px; }
  body.theme-battalion .stat-label { font-size: 11px; }
  body.theme-battalion .stat-foot { font-size: 10px; }
  body.theme-battalion table.data-table tbody tr { padding: 10px 10px 8px; }
  body.theme-battalion .avail-mini { font-size: 11px; }
  body.theme-battalion .page-header .btn { flex: 1 1 auto; }
}
