/* faadumo54: "Pay by" date for debts + the red alert once that date arrives. */

/* ---- Insert / Edit Sale: date under "Customer Has Debt" ---- */
.alpha-debt-date { display: grid; gap: 0.35rem; }
.alpha-debt-date-label { font-size: 0.75rem; font-weight: 700; color: rgb(51 65 85); }
.dark .alpha-debt-date-label { color: rgb(203 213 225); }
.alpha-debt-date-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.alpha-debt-date-input {
  flex: 1 1 10rem;
  min-width: 0;
  padding: 0.5rem;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: #fff;
  color: rgb(15 23 42);
}
.alpha-debt-date-input:focus { outline: none; box-shadow: 0 0 0 2px rgb(239 68 68); }
.alpha-debt-date-input[aria-invalid="true"] { border-color: rgb(220 38 38); background: rgb(254 242 242); }
.dark .alpha-debt-date-input { background: rgb(30 41 59); border-color: rgb(51 65 85); color: #fff; color-scheme: dark; }
.dark .alpha-debt-date-input[aria-invalid="true"] { border-color: rgb(248 113 113); background: rgb(69 10 10 / 0.5); }
.alpha-debt-quick {
  padding: 0.4rem 0.6rem;
  border: 1px solid rgb(226 232 240);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  color: rgb(71 85 105);
  background: #fff;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.alpha-debt-quick:hover { border-color: rgb(252 165 165); color: rgb(185 28 28); }
.alpha-debt-quick.on { background: rgb(220 38 38); border-color: rgb(185 28 28); color: #fff; }
.dark .alpha-debt-quick { background: rgb(30 41 59); border-color: rgb(51 65 85); color: rgb(203 213 225); }
.dark .alpha-debt-quick.on { background: rgb(220 38 38); border-color: rgb(220 38 38); color: #fff; }
.alpha-debt-date-hint { margin: 0; font-size: 0.7rem; color: rgb(100 116 139); }
.alpha-debt-date-hint.late { color: rgb(220 38 38); font-weight: 700; }
.alpha-debt-date-err { margin: 0; font-size: 0.7rem; font-weight: 700; color: rgb(220 38 38); }
.dark .alpha-debt-date-hint { color: rgb(148 163 184); }
.dark .alpha-debt-date-hint.late, .dark .alpha-debt-date-err { color: rgb(248 113 113); }

/* ---- red alert above the sales table ---- */
.alpha-debt-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgb(254 202 202);
  border-left: 4px solid rgb(220 38 38);
  background: linear-gradient(90deg, rgb(254 226 226), rgb(254 242 242));
  color: rgb(153 27 27);
  animation: alpha-debt-in 0.35s ease-out both;
}
.dark .alpha-debt-alert { background: linear-gradient(90deg, rgb(127 29 29 / 0.55), rgb(69 10 10 / 0.35)); border-bottom-color: rgb(127 29 29); color: rgb(254 202 202); }
.alpha-debt-alert-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: rgb(220 38 38);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  box-shadow: 0 0 0 0 rgb(220 38 38 / 0.5);
  animation: alpha-debt-ping 2s ease-out infinite;
}
.alpha-debt-alert-body { flex: 1; min-width: 0; display: grid; gap: 0.35rem; }
.alpha-debt-alert-title { font-size: 0.8rem; font-weight: 800; }
.alpha-debt-alert-title strong { font-weight: 900; color: rgb(185 28 28); }
.dark .alpha-debt-alert-title strong { color: #fff; }
.alpha-debt-alert-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.alpha-debt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgb(252 165 165);
  border-radius: 999px;
  background: #fff;
  font-size: 0.7rem;
  color: rgb(127 29 29);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.alpha-debt-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgb(220 38 38 / 0.2); }
.alpha-debt-chip .n { font-weight: 700; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alpha-debt-chip .a { font-weight: 900; color: rgb(220 38 38); font-variant-numeric: tabular-nums; }
.alpha-debt-chip .w { padding: 0 0.35rem; border-radius: 999px; background: rgb(220 38 38); color: #fff; font-size: 0.6rem; font-weight: 900; text-transform: uppercase; }
.dark .alpha-debt-chip { background: rgb(15 23 42); border-color: rgb(153 27 27); color: rgb(254 202 202); }
.dark .alpha-debt-chip .a { color: rgb(252 165 165); }
.alpha-debt-more { align-self: center; font-size: 0.7rem; font-weight: 800; }
.alpha-debt-show {
  flex: none;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 0.6rem;
  background: rgb(220 38 38);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}
.alpha-debt-show:hover { background: rgb(185 28 28); }
@media (max-width: 640px) {
  .alpha-debt-alert { flex-wrap: wrap; padding: 0.6rem 0.75rem; }
  .alpha-debt-alert-body { flex-basis: calc(100% - 2.7rem); }
  .alpha-debt-show { margin-left: 2.65rem; }
}
@keyframes alpha-debt-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes alpha-debt-ping { 0% { box-shadow: 0 0 0 0 rgb(220 38 38 / 0.45); } 70%, 100% { box-shadow: 0 0 0 8px rgb(220 38 38 / 0); } }
@media (prefers-reduced-motion: reduce) { .alpha-debt-alert, .alpha-debt-alert-icon { animation: none; } }

/* ---- faadumo56: big message when a debt is saved (top centre, 9 s) ---- */
.alpha-debt-notice {
  position: fixed;
  z-index: 75;
  top: 18px;
  left: 50%;
  width: min(440px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 18px;
  overflow: hidden;
  border: 1px solid rgb(253 230 138);
  border-left: 6px solid rgb(245 158 11);
  border-radius: 16px;
  background: #fff;
  color: rgb(15 23 42);
  box-shadow: 0 18px 45px rgb(15 23 42 / 0.22), 0 2px 6px rgb(15 23 42 / 0.08);
  transform: translateX(-50%);
  animation: alpha-debt-notice-in 0.45s cubic-bezier(.2, .9, .3, 1.2) both;
}
.alpha-debt-notice.is-due { border-color: rgb(254 202 202); border-left-color: rgb(220 38 38); }
.dark .alpha-debt-notice { background: rgb(15 23 42); color: #fff; border-color: rgb(120 53 15); border-left-color: rgb(245 158 11); }
.dark .alpha-debt-notice.is-due { border-color: rgb(127 29 29); border-left-color: rgb(239 68 68); }
.alpha-debt-notice-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgb(245 158 11);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
}
.alpha-debt-notice.is-due .alpha-debt-notice-icon { background: rgb(220 38 38); }
.alpha-debt-notice-body { min-width: 0; display: grid; gap: 2px; }
.alpha-debt-notice-body p { margin: 0; }
.alpha-debt-notice-kicker { font-size: 0.68rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(180 83 9); }
.alpha-debt-notice.is-due .alpha-debt-notice-kicker { color: rgb(220 38 38); }
.dark .alpha-debt-notice-kicker { color: rgb(252 211 77); }
.dark .alpha-debt-notice.is-due .alpha-debt-notice-kicker { color: rgb(252 165 165); }
/* Wraps instead of cutting: the amount must always show, even after a long name. */
.alpha-debt-notice-main { font-size: 1.05rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.alpha-debt-notice-main .amt { white-space: nowrap; }
.alpha-debt-notice-main strong { font-weight: 900; }
.alpha-debt-notice-main .amt { font-size: 1.35rem; font-weight: 900; color: rgb(220 38 38); font-variant-numeric: tabular-nums; }
.dark .alpha-debt-notice-main .amt { color: rgb(248 113 113); }
.alpha-debt-notice-sub { font-size: 0.75rem; color: rgb(100 116 139); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .alpha-debt-notice-sub { color: rgb(148 163 184); }
.alpha-debt-notice-due { font-size: 0.8rem; font-weight: 600; color: rgb(51 65 85); }
.alpha-debt-notice-due strong { font-weight: 900; }
.alpha-debt-notice.is-due .alpha-debt-notice-due { color: rgb(220 38 38); }
.dark .alpha-debt-notice-due { color: rgb(226 232 240); }
.alpha-debt-notice-ok {
  align-self: start;
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 0.6rem;
  background: rgb(15 23 42);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}
.alpha-debt-notice-ok:hover { background: rgb(51 65 85); }
.dark .alpha-debt-notice-ok { background: #fff; color: rgb(15 23 42); }
.alpha-debt-notice-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: rgb(245 158 11);
  transform-origin: left;
  animation: alpha-debt-notice-timer 9s linear both;
}
.alpha-debt-notice.is-due .alpha-debt-notice-timer { background: rgb(220 38 38); }
@keyframes alpha-debt-notice-in {
  from { opacity: 0; transform: translate(-50%, -24px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes alpha-debt-notice-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .alpha-debt-notice { animation: none; }
}

/* ---- faadumo57: Customer Has Debt — price · cost · paid now → client owes ---- */
.alpha-debt-panel { display: grid; gap: 0.6rem; padding-top: 0.6rem; border-top: 1px solid rgb(226 232 240); }
.dark .alpha-debt-panel { border-top-color: rgb(51 65 85); }
.alpha-debt-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.alpha-debt-field { display: grid; gap: 0.2rem; min-width: 0; }
.alpha-debt-field > span { font-size: 0.72rem; font-weight: 800; color: rgb(51 65 85); }
.dark .alpha-debt-field > span { color: rgb(203 213 225); }
.alpha-debt-field input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  background: #fff;
  color: rgb(15 23 42);
}
.alpha-debt-field input:focus { outline: none; box-shadow: 0 0 0 2px rgb(239 68 68); }
.alpha-debt-field input[data-alpha-debt="paid"] { border-color: rgb(134 239 172); background: rgb(240 253 244); }
.dark .alpha-debt-field input { background: rgb(30 41 59); border-color: rgb(51 65 85); color: #fff; }
.dark .alpha-debt-field input[data-alpha-debt="paid"] { background: rgb(5 46 22 / 0.5); border-color: rgb(22 101 52); }
.alpha-debt-field small { font-size: 0.65rem; color: rgb(148 163 184); }
.alpha-debt-quickpay { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.alpha-debt-owes {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  background: rgb(254 242 242);
  border: 1px solid rgb(254 202 202);
}
.alpha-debt-owes > span { font-size: 0.8rem; font-weight: 800; color: rgb(153 27 27); }
.alpha-debt-owes > strong { font-size: 1.5rem; font-weight: 900; color: rgb(220 38 38); font-variant-numeric: tabular-nums; }
.alpha-debt-owes > small { grid-column: 1 / -1; font-size: 0.72rem; color: rgb(100 116 139); }
.alpha-debt-owes.zero { background: rgb(240 253 244); border-color: rgb(187 247 208); }
.alpha-debt-owes.zero > span, .alpha-debt-owes.zero > strong { color: rgb(21 128 61); }
.dark .alpha-debt-owes { background: rgb(69 10 10 / 0.45); border-color: rgb(127 29 29); }
.dark .alpha-debt-owes > span { color: rgb(254 202 202); }
.dark .alpha-debt-owes > strong { color: rgb(248 113 113); }
.dark .alpha-debt-owes > small { color: rgb(148 163 184); }
.dark .alpha-debt-owes.zero { background: rgb(5 46 22 / 0.45); border-color: rgb(22 101 52); }
.dark .alpha-debt-owes.zero > span, .dark .alpha-debt-owes.zero > strong { color: rgb(134 239 172); }
.alpha-debt-full { margin: 0; font-size: 0.75rem; font-weight: 700; color: rgb(21 128 61); text-align: right; }
.dark .alpha-debt-full { color: rgb(134 239 172); }
@media (max-width: 420px) { .alpha-debt-fields { grid-template-columns: 1fr 1fr; } .alpha-debt-fields > :last-child { grid-column: 1 / -1; } }

/* ---- faadumo57: Receive payment ---- */
.alpha-pay-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(2 6 23 / 0.6);
  backdrop-filter: blur(4px);
  animation: alpha-debt-in 0.2s ease-out both;
}
.alpha-pay {
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: grid;
  gap: 0.8rem;
  padding: 1.1rem;
  border-radius: 1.1rem;
  background: #fff;
  color: rgb(15 23 42);
  box-shadow: 0 24px 60px rgb(2 6 23 / 0.35);
}
.dark .alpha-pay { background: rgb(15 23 42); color: #fff; border: 1px solid rgb(30 41 59); }
.alpha-pay-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.7rem; }
.alpha-pay-head h2 { margin: 0; font-size: 1.05rem; font-weight: 900; }
.alpha-pay-head p { margin: 0; font-size: 0.75rem; color: rgb(100 116 139); overflow-wrap: anywhere; }
.alpha-pay-icon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 0.8rem; background: rgb(22 163 74); color: #fff; font-weight: 900; font-size: 1.1rem; }
.alpha-pay-x { width: 2rem; height: 2rem; border: none; border-radius: 0.6rem; background: transparent; color: rgb(100 116 139); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.alpha-pay-x:hover { background: rgb(241 245 249); }
.dark .alpha-pay-x:hover { background: rgb(30 41 59); }
.alpha-pay-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.alpha-pay-stats > div { display: grid; gap: 0.15rem; padding: 0.55rem 0.6rem; border-radius: 0.7rem; background: rgb(248 250 252); border: 1px solid rgb(226 232 240); }
.alpha-pay-stats span { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: rgb(100 116 139); }
.alpha-pay-stats strong { font-size: 1rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.alpha-pay-stats .owes { background: rgb(254 242 242); border-color: rgb(254 202 202); }
.alpha-pay-stats .owes strong { color: rgb(220 38 38); }
.dark .alpha-pay-stats > div { background: rgb(30 41 59); border-color: rgb(51 65 85); }
.dark .alpha-pay-stats .owes { background: rgb(69 10 10 / 0.45); border-color: rgb(127 29 29); }
.dark .alpha-pay-stats .owes strong { color: rgb(248 113 113); }
.alpha-pay-label { display: grid; gap: 0.3rem; font-size: 0.75rem; font-weight: 800; color: rgb(51 65 85); }
.dark .alpha-pay-label { color: rgb(203 213 225); }
.alpha-pay-input { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid rgb(203 213 225); border-radius: 0.6rem; font-size: 1rem; font-weight: 700; background: #fff; color: rgb(15 23 42); }
.alpha-pay-input:focus { outline: none; box-shadow: 0 0 0 2px rgb(34 197 94); }
.alpha-pay-input[aria-invalid="true"] { border-color: rgb(220 38 38); background: rgb(254 242 242); }
.dark .alpha-pay-input { background: rgb(30 41 59); border-color: rgb(51 65 85); color: #fff; }
.alpha-pay-after { margin: 0; font-size: 0.85rem; font-weight: 700; color: rgb(185 28 28); }
.alpha-pay-after strong { font-weight: 900; }
.alpha-pay-after.done { color: rgb(21 128 61); }
.dark .alpha-pay-after { color: rgb(252 165 165); }
.dark .alpha-pay-after.done { color: rgb(134 239 172); }
.alpha-pay-none { margin: 0; font-size: 0.85rem; font-weight: 700; color: rgb(21 128 61); }
.alpha-pay-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.2rem; }
.alpha-pay-cancel, .alpha-pay-save { padding: 0.55rem 1rem; border-radius: 0.7rem; font-size: 0.85rem; font-weight: 800; cursor: pointer; }
.alpha-pay-cancel { border: 1px solid rgb(226 232 240); background: #fff; color: rgb(51 65 85); }
.dark .alpha-pay-cancel { background: rgb(30 41 59); border-color: rgb(51 65 85); color: rgb(226 232 240); }
.alpha-pay-save { border: none; background: rgb(22 163 74); color: #fff; box-shadow: 0 4px 12px rgb(22 163 74 / 0.3); }
.alpha-pay-save:hover { background: rgb(21 128 61); }
.alpha-pay-save:disabled { opacity: 0.6; cursor: wait; }
