/**
 * ป้ายสถานะใบแจ้งหนี้ — สีตามสถานะ (ใช้คู่กับ Invoice::getStatus())
 * โหลดทั้งแอดมินและหน้านักเรียน
 */
.invoice-status-badge {
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.35em 0.7em;
  border: 1px solid transparent;
}

/*
 * Bootstrap .badge ใช้ color: var(--bs-badge-color) โดยค่าเริ่มต้นเป็นขาว
 * ป้ายอยู่ใน <button class="invoice-mobile-card"> จึงอาจถูกกฎ button .badge ของธีมทับ
 * กำหนดทั้ง --bs-badge-color และ color + selector คู่ .invoice-status-badge
 */
/* ยังไม่ชำระ — แดง */
.invoice-status-badge.invoice-status--unpaid,
.invoice-status--unpaid {
  --bs-badge-color: #991b1b;
  background: rgba(220, 38, 38, 0.12);
  color: #991b1b !important;
  border-color: rgba(220, 38, 38, 0.22);
}

button.invoice-mobile-card .invoice-status-badge.invoice-status--unpaid,
.invoice-mobile-card .invoice-status-badge.invoice-status--unpaid {
  --bs-badge-color: #991b1b !important;
  color: #991b1b !important;
}

/* ชำระแล้ว — เขียว */
.invoice-status-badge.invoice-status--paid,
.invoice-status--paid {
  --bs-badge-color: #166534;
  background: rgba(22, 163, 74, 0.14);
  color: #166534 !important;
  border-color: rgba(22, 163, 74, 0.28);
}

button.invoice-mobile-card .invoice-status-badge.invoice-status--paid,
.invoice-mobile-card .invoice-status-badge.invoice-status--paid {
  --bs-badge-color: #166534 !important;
  color: #166534 !important;
}

/* ชำระบางส่วน — เหลือง */
.invoice-status-badge.invoice-status--partial,
.invoice-status--partial {
  --bs-badge-color: #854d0e;
  background: rgba(234, 179, 8, 0.22);
  color: #854d0e !important;
  border-color: rgba(202, 138, 4, 0.35);
}

button.invoice-mobile-card .invoice-status-badge.invoice-status--partial,
.invoice-mobile-card .invoice-status-badge.invoice-status--partial {
  --bs-badge-color: #854d0e !important;
  color: #854d0e !important;
}

/* ยกเลิก — เทา */
.invoice-status-badge.invoice-status--canceled,
.invoice-status--canceled {
  --bs-badge-color: #334155;
  background: rgba(100, 116, 139, 0.16);
  color: #334155 !important;
  border-color: rgba(100, 116, 139, 0.28);
}

button.invoice-mobile-card .invoice-status-badge.invoice-status--canceled,
.invoice-mobile-card .invoice-status-badge.invoice-status--canceled {
  --bs-badge-color: #334155 !important;
  color: #334155 !important;
}

[data-bs-theme="dark"] .invoice-status-badge.invoice-status--unpaid,
[data-bs-theme="dark"] .invoice-status--unpaid {
  --bs-badge-color: #fecaca;
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.3);
}

[data-bs-theme="dark"] button.invoice-mobile-card .invoice-status-badge.invoice-status--unpaid,
[data-bs-theme="dark"] .invoice-mobile-card .invoice-status-badge.invoice-status--unpaid {
  --bs-badge-color: #fecaca !important;
  color: #fecaca !important;
}

[data-bs-theme="dark"] .invoice-status-badge.invoice-status--paid,
[data-bs-theme="dark"] .invoice-status--paid {
  --bs-badge-color: #86efac;
  background: rgba(74, 222, 128, 0.12);
  color: #86efac !important;
  border-color: rgba(74, 222, 128, 0.25);
}

[data-bs-theme="dark"] button.invoice-mobile-card .invoice-status-badge.invoice-status--paid,
[data-bs-theme="dark"] .invoice-mobile-card .invoice-status-badge.invoice-status--paid {
  --bs-badge-color: #86efac !important;
  color: #86efac !important;
}

[data-bs-theme="dark"] .invoice-status-badge.invoice-status--partial,
[data-bs-theme="dark"] .invoice-status--partial {
  --bs-badge-color: #facc15;
  background: rgba(250, 204, 21, 0.14);
  color: #facc15 !important;
  border-color: rgba(250, 204, 21, 0.28);
}

[data-bs-theme="dark"] button.invoice-mobile-card .invoice-status-badge.invoice-status--partial,
[data-bs-theme="dark"] .invoice-mobile-card .invoice-status-badge.invoice-status--partial {
  --bs-badge-color: #facc15 !important;
  color: #facc15 !important;
}

[data-bs-theme="dark"] .invoice-status-badge.invoice-status--canceled,
[data-bs-theme="dark"] .invoice-status--canceled {
  --bs-badge-color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.28);
}

[data-bs-theme="dark"] button.invoice-mobile-card .invoice-status-badge.invoice-status--canceled,
[data-bs-theme="dark"] .invoice-mobile-card .invoice-status-badge.invoice-status--canceled {
  --bs-badge-color: #cbd5e1 !important;
  color: #cbd5e1 !important;
}

/* ===== การ์ดมือถือ — กระชับ / ระยะห่างรายการ (สองคลาสชนะ gap จาก mobilePublicShell) ===== */
.inquiry-livewire-root .invoice-mobile-list {
  gap: 0.45rem;
}

.invoice-mobile-list .invoice-mobile-card {
  padding: 0.5rem 0.6rem;
  border-radius: 0.85rem;
}

.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--unpaid,
.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--paid,
.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--partial,
.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--canceled {
  border-left-width: 3px;
}

.invoice-mobile-list .invoice-mobile-card__icon {
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 0.65rem;
  font-size: 1.1rem;
}

.invoice-mobile-list .invoice-mobile-card__headline {
  gap: 0.35rem;
}

.invoice-mobile-list .invoice-mobile-card__headline .invoice-mobile-card__number {
  font-size: 0.9375rem;
}

.invoice-mobile-list .invoice-mobile-card__headline .invoice-mobile-card__amount {
  font-size: 0.9375rem;
}

.invoice-mobile-list .invoice-mobile-card__desc {
  -webkit-line-clamp: 1;
  margin-bottom: 0.35rem !important;
  font-size: 0.8125rem;
  line-height: 1.35;
}

/* ===== การ์ดมือถือ / แถวตาราง — พื้นหลังทั้งใบตามสถานะ =====
   ใช้ .invoice-mobile-card.invoice-mobile-card--* (สองคลาส) เพื่อชนะกฎท้ายเอกสารใน mobilePublicShell ที่ตั้ง background ขาว */
.invoice-mobile-card.invoice-mobile-card--unpaid {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.95) 0%, rgba(254, 242, 242, 0.92) 100%);
  border-color: rgba(185, 28, 28, 0.45);
  border-left: 4px solid #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12);
}

.invoice-mobile-card.invoice-mobile-card--paid {
  background: linear-gradient(135deg, rgba(220, 252, 231, 0.95) 0%, rgba(240, 253, 244, 0.92) 100%);
  border-color: rgba(21, 128, 61, 0.4);
  border-left: 4px solid #16a34a;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.12);
}

.invoice-mobile-card.invoice-mobile-card--partial {
  background: linear-gradient(135deg, rgba(254, 249, 195, 0.95) 0%, rgba(254, 252, 232, 0.92) 100%);
  border-color: rgba(180, 83, 9, 0.42);
  border-left: 4px solid #ca8a04;
  box-shadow: 0 2px 8px rgba(202, 138, 4, 0.14);
}

.invoice-mobile-card.invoice-mobile-card--canceled {
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
  border-color: rgba(71, 85, 105, 0.35);
  border-left: 4px solid #64748b;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.1);
}

.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--unpaid .invoice-mobile-card__number,
.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--paid .invoice-mobile-card__number,
.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--partial .invoice-mobile-card__number,
.invoice-mobile-list .invoice-mobile-card.invoice-mobile-card--canceled .invoice-mobile-card__number {
  font-weight: 700;
  font-size: 1rem;
}

.invoice-mobile-list .invoice-mobile-card .invoice-mobile-card__desc {
  opacity: 1;
  color: #334155;
  font-size: 0.875rem;
}

.invoice-mobile-list .invoice-mobile-card .invoice-mobile-card__pill {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.07);
  color: #475569;
}

.invoice-mobile-list .invoice-mobile-card .invoice-mobile-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-mobile-list .invoice-mobile-card .invoice-status-badge {
  font-size: 0.75rem;
  padding: 0.28em 0.65em;
}

.invoice-mobile-card.invoice-mobile-card--unpaid .invoice-mobile-card__amount {
  color: #b91c1c;
}

.invoice-mobile-card.invoice-mobile-card--paid .invoice-mobile-card__amount {
  color: #15803d;
}

.invoice-mobile-card.invoice-mobile-card--partial .invoice-mobile-card__amount {
  color: #b45309;
}

.invoice-mobile-card.invoice-mobile-card--canceled .invoice-mobile-card__amount {
  color: #475569;
}

.invoice-mobile-card.invoice-mobile-card--unpaid .invoice-mobile-card__icon {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.invoice-mobile-card.invoice-mobile-card--paid .invoice-mobile-card__icon {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.invoice-mobile-card.invoice-mobile-card--partial .invoice-mobile-card__icon {
  background: #ca8a04;
  color: #fff;
  box-shadow: 0 4px 12px rgba(202, 138, 4, 0.35);
}

.invoice-mobile-card.invoice-mobile-card--canceled .invoice-mobile-card__icon {
  background: #64748b;
  color: #fff;
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.28);
}

.invoice-mobile-card.invoice-mobile-card--active .invoice-mobile-card__icon {
  background: var(--bs-primary) !important;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(var(--bs-primary-rgb, 105 108 255), 0.35) !important;
}

.table tbody tr.invoice-table-row--unpaid > * {
  background-color: rgba(220, 38, 38, 0.08) !important;
  box-shadow: none;
}

.table tbody tr.invoice-table-row--paid > * {
  background-color: rgba(22, 163, 74, 0.09) !important;
  box-shadow: none;
}

.table tbody tr.invoice-table-row--partial > * {
  background-color: rgba(234, 179, 8, 0.12) !important;
  box-shadow: none;
}

.table tbody tr.invoice-table-row--canceled > * {
  background-color: rgba(100, 116, 139, 0.1) !important;
  box-shadow: none;
}

.table tbody tr.invoice-table-row--unpaid.table-active > *,
.table tbody tr.invoice-table-row--paid.table-active > *,
.table tbody tr.invoice-table-row--partial.table-active > *,
.table tbody tr.invoice-table-row--canceled.table-active > * {
  background-color: rgba(var(--bs-primary-rgb, 105 108 255), 0.14) !important;
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--unpaid {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.55) 0%, rgba(30, 27, 45, 0.92) 100%);
  border-color: rgba(248, 113, 113, 0.45);
  border-left-color: #f87171;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--paid {
  background: linear-gradient(135deg, rgba(20, 83, 45, 0.5) 0%, rgba(24, 33, 28, 0.92) 100%);
  border-color: rgba(74, 222, 128, 0.4);
  border-left-color: #4ade80;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--partial {
  background: linear-gradient(135deg, rgba(113, 63, 18, 0.5) 0%, rgba(35, 32, 24, 0.92) 100%);
  border-color: rgba(250, 204, 21, 0.4);
  border-left-color: #facc15;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--canceled {
  background: linear-gradient(135deg, rgba(51, 65, 85, 0.45) 0%, rgba(30, 32, 40, 0.92) 100%);
  border-color: rgba(148, 163, 184, 0.35);
  border-left-color: #94a3b8;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .invoice-mobile-list .invoice-mobile-card .invoice-mobile-card__desc {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .invoice-mobile-list .invoice-mobile-card .invoice-mobile-card__pill {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--unpaid .invoice-mobile-card__icon {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--paid .invoice-mobile-card__icon {
  background: rgba(74, 222, 128, 0.16);
  color: #86efac;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.3);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--partial .invoice-mobile-card__icon {
  background: rgba(250, 204, 21, 0.2);
  color: #422006;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.35);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--canceled .invoice-mobile-card__icon {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
}

[data-bs-theme="dark"] .invoice-mobile-card.invoice-mobile-card--active .invoice-mobile-card__icon {
  background: rgba(var(--bs-primary-rgb, 105 108 255), 0.3);
  color: #a5b4fc;
  box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb, 105 108 255), 0.45);
}
