/* รอบ 61a: รายรับอื่นของโรงเรียน (/school/income — Components/Pages/School/SchoolIncomes.razor)
   - ใช้โครง .fit ของ fit.css + ชิ้นส่วนของหน้ารายจ่าย (expenses.css: exp-dot, exp-cat, exp-pf + pf-collect/pf-account/pf-cash,
     exp-chips, exp-catrow, exp-pfseg, exp-catgrid, exp-amount, exp-toast, exp-mbar, exp-d-amount, exp-catman)
   - คลาสของหน้านี้ขึ้นต้น sin- · สีใช้ตัวแปรของธีม (โหมดมืดใช้ได้) */

@media screen {
  /* ---------- หัว ---------- */
  .sin-tools { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .sin-pick {
    display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 10px; max-width: 100%; min-width: 0;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted);
  }
  .sin-pick:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
  .sin-pick svg { flex: none; }
  .sin-pick select {
    min-width: 0; max-width: 240px; padding: 8px 2px; border: 0; outline: 0; background: none; color: var(--ink);
    font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
  }
  .sin-month { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .sin-mbtn { min-width: 40px; padding-left: 8px; padding-right: 8px; font-size: 1.15rem; line-height: 1; }
  .sin-minput { min-width: 0; width: 150px; min-height: 42px; }
  .sin-add-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; }

  /* ---------- ตัวเลขสรุป ---------- */
  .sin-stats { grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1.6fr); }
  .sin-stats .fit-stat small { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sin-stat-total { background: var(--ok); color: #fff; }
  .sin-stat-total.fit-stat.hl strong { color: #fff; }
  .sin-stat-total > span, .sin-stat-total > small.muted { color: #fff; opacity: .88; }
  .sin-inlist { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: .82rem; color: var(--muted); }
  .sin-inlist > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  .sin-inlist i { width: 9px; height: 9px; border-radius: 3px; background: var(--pf); }
  .sin-inlist b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

  /* ---------- ตาราง ---------- */
  .sin-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .sin-table th { padding: 9px 12px; }
  .sin-table tr:last-child td { border-bottom: 0; }
  .sin-c-date { white-space: nowrap; color: var(--muted); font-size: .86rem; }
  .sin-c-amt { white-space: nowrap; }
  .sin-c-amt strong { font-weight: 700; color: var(--ok); }
  .sin-c-by { font-size: .86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sin-c-st { white-space: nowrap; }
  .sin-payer { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sin-note { display: block; font-size: .78rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sin-br {
    display: inline-block; margin-top: 2px; padding: 0 8px; border-radius: 999px; max-width: 100%;
    background: var(--chip); color: var(--muted); font-size: .72rem; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top;
  }
  .sin-ok { font-size: .78rem; font-weight: 600; color: var(--ok); }
  .sin-row { cursor: pointer; }
  .sin-row:hover td { background: var(--chip); }
  .sin-row.open td { background: var(--brand-tint); }
  .sin-row.voided td { color: var(--muted); }
  .sin-row.voided .sin-c-amt strong, .sin-row.voided .sin-payer, .sin-row.voided .exp-cat > span { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
  .sin-row.voided .exp-dot { opacity: .45; }
  .sin-side-total { padding-top: 6px; border-top: 1px solid var(--line); }
  .sin-create .exp-pfseg button { min-height: 76px; }
}

/* จอคอม: ความกว้างคอลัมน์คงที่ ไม่ล้นแผง */
@media screen and (min-width: 761px) {
  .sin-table { table-layout: fixed; width: 100%; }
  .sin-table th.sin-c-date { width: 82px; }
  .sin-table th.sin-c-cat { width: 22%; }
  .sin-table th.sin-c-in { width: 104px; }
  .sin-table th.sin-c-amt { width: 128px; }
  .sin-table th.sin-c-by { width: 110px; }
  .sin-table th.sin-c-st { width: 86px; }
  .sin-table .sin-c-cat, .sin-table .sin-c-payer { overflow: hidden; }
}
@media screen and (min-width: 761px) and (max-width: 1360px) {
  .sin-table th, .sin-table td { padding-left: 9px; padding-right: 9px; }
  .sin-table th.sin-c-by, .sin-table td.sin-c-by { display: none; }
  .sin-table th.sin-c-st { width: 74px; }
}
@media screen and (min-width: 761px) and (max-width: 1024px) {
  .sin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sin-stats .sin-stat-in { grid-column: 1 / -1; }
}

/* ---------- มือถือ (390px: ไม่เลื่อนแนวนอน) ---------- */
@media screen and (max-width: 760px) {
  .sin-tools { justify-content: stretch; }
  .sin-tools .sin-pick { flex: 1 1 100%; }
  .sin-pick select { max-width: none; flex: 1 1 auto; }
  .sin-month { flex: 1 1 100%; }
  .sin-minput { flex: 1 1 auto; width: auto; }
  .sin-tools .sin-add-btn { display: none; }
  .sin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sin-stats .fit-stat { padding: 10px 12px; }
  .sin-stats .sin-stat-in { grid-column: 1 / -1; }
  .sin-table thead { display: none; }
  .sin-table, .sin-table tbody { display: block; width: 100%; }
  .sin-table tr.sin-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-bottom: 8px; padding: 11px 14px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
  }
  .sin-table tr.sin-row td { display: block; padding: 0 !important; border: 0; background: none !important; max-width: none; min-width: 0; }
  .sin-table .sin-c-cat { order: 1; flex: 1 1 0; font-weight: 700; }
  .sin-table .sin-c-amt { order: 2; flex: none; font-size: 1.02rem; }
  .sin-table .sin-c-payer { order: 3; flex: 1 1 100%; font-size: .9rem; }
  .sin-table .sin-c-date { order: 4; font-size: .8rem; }
  .sin-table .sin-c-in { order: 5; }
  .sin-table .sin-c-by { order: 6; font-size: .8rem; flex: 1 1 0; }
  .sin-table .sin-c-st { order: 7; margin-left: auto; }
  .sin-note { white-space: normal; }
  .sin-row.open { border-color: var(--brand) !important; }
}

/* ---------- โหมดมืด ---------- */
@media screen {
  html[data-theme="dark"] .sin-stat-total { background: color-mix(in srgb, var(--ok) 72%, #1F1D1B); }
}
