/* =============================================================================
   Adobe license stages (release faadumo51) — src/components/AlphaLicenseStages.jsx
   Badge (sales table), due bar (above the table) and dialog (.als-root).
   ============================================================================= */

/* ---------- badge under the service name ---------- */
.als-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font: inherit;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.15s;
}
.als-badge svg { width: 11px; height: 11px; flex: none; }
.als-badge:hover { transform: translateY(-1px); }
.als-badge--due { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.als-badge--overdue { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.als-badge--done { opacity: 0.7; }
.dark .als-badge { background: #1e293b; border-color: #334155; color: #cbd5e1; }
.dark .als-badge--due { background: rgba(251, 191, 36, 0.12); border-color: #92400e; color: #fcd34d; }
.dark .als-badge--overdue { background: rgba(248, 113, 113, 0.12); border-color: #991b1b; color: #fca5a5; }

/* ---------- bar above the sales table ---------- */
.als-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #78350f;
  font-size: 13px;
  animation: als-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.als-bar--overdue { border-color: #fca5a5; background: #fef2f2; color: #7f1d1d; }
.als-bar-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #f59e0b; color: #fff; flex: none; }
.als-bar--overdue .als-bar-icon { background: #dc2626; }
.als-bar-icon svg { width: 17px; height: 17px; }
.als-bar-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.als-bar-text strong { font-weight: 800; }
.als-bar-text em { font-style: normal; font-weight: 800; color: #dc2626; }
.als-bar-names { color: inherit; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dark .als-bar { background: rgba(251, 191, 36, 0.1); border-color: #92400e; color: #fde68a; }
.dark .als-bar--overdue { background: rgba(248, 113, 113, 0.1); border-color: #991b1b; color: #fecaca; }
@keyframes als-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- dialog ---------- */
.als-root {
  --als-surface: #ffffff;
  --als-canvas: #f8fafc;
  --als-ink: #0f172a;
  --als-text: #1e293b;
  --als-muted: #64748b;
  --als-line: #e2e8f0;
  --als-brand: #e11d2e;
  --als-brand-deep: #be123c;
  --als-good: #047857;
  --als-good-soft: #ecfdf5;
  --als-warn: #b45309;
  --als-warn-soft: #fffbeb;
  --als-bad: #dc2626;
  --als-bad-soft: #fef2f2;
}
.dark .als-root {
  --als-surface: #0f172a;
  --als-canvas: #111c33;
  --als-ink: #f8fafc;
  --als-text: #e2e8f0;
  --als-muted: #94a3b8;
  --als-line: #1e293b;
  --als-brand: #ef4444;
  --als-brand-deep: #dc2626;
  --als-good: #6ee7b7;
  --als-good-soft: rgba(52, 211, 153, 0.12);
  --als-warn: #fcd34d;
  --als-warn-soft: rgba(251, 191, 36, 0.12);
  --als-bad: #fca5a5;
  --als-bad-soft: rgba(248, 113, 113, 0.12);
}
.als-root *, .als-root *::before, .als-root *::after { box-sizing: border-box; }
.als-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  animation: als-fade 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.als-dialog {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--als-surface);
  color: var(--als-text);
  border: 1px solid var(--als-line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  overflow: hidden;
  animation: als-pop 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes als-fade { from { opacity: 0; } }
@keyframes als-pop { from { opacity: 0; transform: scale(0.96); } }
.als-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--als-line); }
.als-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--als-brand); color: #fff; flex: none; }
.als-icon svg, .als-x svg { width: 18px; height: 18px; }
.als-head-text { flex: 1; min-width: 0; }
.als-head h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--als-ink); overflow-wrap: anywhere; }
.als-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--als-muted); }
.als-x { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--als-muted); cursor: pointer; }
.als-x:hover { background: var(--als-canvas); color: var(--als-ink); }
.als-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px; overflow-y: auto; }
.als-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--als-line); }
.als-back { margin-right: auto; }
.als-muted { margin: 0; color: var(--als-muted); font-size: 13.5px; }
.als-warn { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--als-warn-soft); color: var(--als-warn); font-size: 13px; font-weight: 700; }

.als-now { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.als-now > div { padding: 10px 12px; border-radius: 12px; background: var(--als-canvas); border: 1px solid var(--als-line); min-width: 0; }
.als-now span { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--als-muted); }
.als-now strong { display: block; margin-top: 2px; font-size: 14.5px; font-weight: 800; color: var(--als-ink); }

.als-stages { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.als-stage { border: 1px solid var(--als-line); border-radius: 14px; padding: 12px; background: var(--als-surface); }
.als-stage--overdue { border-color: var(--als-bad); background: var(--als-bad-soft); }
.als-stage--due { border-color: var(--als-warn); }
.als-stage-top { display: flex; align-items: center; gap: 12px; }
.als-stage-no { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--als-canvas); border: 1px solid var(--als-line); font-weight: 800; color: var(--als-ink); flex: none; }
.als-stage--sent .als-stage-no { background: var(--als-good); border-color: var(--als-good); color: #fff; }
.als-stage-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.als-stage-main strong { color: var(--als-ink); font-size: 14px; font-weight: 800; }
.als-stage-main span { font-size: 12.5px; color: var(--als-text); font-variant-numeric: tabular-nums; }
.als-stage-main small { font-size: 12px; color: var(--als-muted); overflow-wrap: anywhere; }
.als-pill { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.als-pill--good { background: var(--als-good-soft); color: var(--als-good); }
.als-pill--bad { background: var(--als-bad); color: #fff; }
.als-pill--warn { background: var(--als-warn-soft); color: var(--als-warn); }
.als-pill--muted { background: var(--als-canvas); color: var(--als-muted); }

.als-send { display: grid; grid-template-columns: 160px 1fr; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--als-line); }
.als-send label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.als-send label span { font-size: 12px; font-weight: 700; color: var(--als-text); }
.als-send-note { grid-column: 1 / -1; }
.als-send input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--als-line);
  background: var(--als-surface);
  color: var(--als-text);
  font: inherit;
  font-size: 14px;
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.als-send input:focus { border-color: var(--als-brand); box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.14); }
.dark .als-root .als-send input[type="date"] { color-scheme: dark; }
.als-send-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

.als-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.als-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--als-line); border-radius: 12px; }
.als-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.als-list strong { color: var(--als-ink); font-weight: 800; }
.als-list li > div span { font-size: 12px; color: var(--als-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.als-list .als-badge { margin-top: 0; cursor: default; }

/* buttons (dialog + bar) */
.als-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s;
}
.als-btn svg { width: 14px; height: 14px; }
.als-btn:hover:not(:disabled) { transform: translateY(-1px); }
.als-btn:active:not(:disabled) { transform: scale(0.97); }
.als-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.als-btn--primary { background: #e11d2e; color: #fff; box-shadow: 0 6px 16px rgba(225, 29, 46, 0.22); }
.als-btn--primary:hover:not(:disabled) { background: #be123c; }
.als-btn--ghost { background: var(--als-surface, #fff); border-color: var(--als-line, #e2e8f0); color: var(--als-text, #1e293b); }
.als-btn--dark { background: #0f172a; color: #fff; }
.dark .als-btn--dark { background: #f8fafc; color: #0f172a; }
.als-root button:focus-visible, .als-badge:focus-visible, .als-bar button:focus-visible { outline: 2px solid #e11d2e; outline-offset: 2px; }

@media (max-width: 640px) {
  .als-overlay { align-items: flex-end; padding: 0; }
  .als-dialog { max-width: none; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .als-head, .als-body, .als-foot { padding-left: 16px; padding-right: 16px; }
  .als-now { grid-template-columns: 1fr 1fr; }
  .als-now > div:last-child { grid-column: 1 / -1; }
  .als-stage-top { flex-wrap: wrap; }
  .als-stage-main { flex-basis: calc(100% - 42px); }
  .als-stage-top .als-pill { margin-left: 42px; }
  .als-stage-top .als-btn { margin-left: auto; }
  .als-send { grid-template-columns: 1fr; }
  .als-send input, .als-btn { height: 44px; font-size: 15px; }
  .als-list li { flex-wrap: wrap; }
  .als-bar { flex-wrap: wrap; }
  .als-bar .als-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .als-overlay, .als-dialog, .als-bar { animation: none; }
  .als-btn, .als-badge { transition: none; }
  .als-btn:hover:not(:disabled), .als-btn:active:not(:disabled), .als-badge:hover { transform: none; }
}

/* faadumo52: account email per stage (all stages editable) */
.als-email { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; padding: 3px 4px 3px 9px; align-self: flex-start; max-width: 100%; border-radius: 8px; background: var(--als-canvas); border: 1px solid var(--als-line); color: var(--als-ink) !important; font-size: 12.5px !important; font-weight: 700; overflow-wrap: anywhere; }
.als-email.is-empty { color: var(--als-muted) !important; font-weight: 600; font-style: italic; padding-right: 9px; }
.als-copy { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--als-muted); cursor: pointer; flex: none; }
.als-copy:hover { background: var(--als-surface); color: var(--als-ink); }
.als-copy svg { width: 13px; height: 13px; }
.als-stage-btns { display: inline-flex; gap: 6px; }
@media (max-width: 640px) {
  .als-stage-top .als-stage-btns { margin-left: auto; }
}

/* faadumo52: the dashboard's toasts stay readable above the Add Time /
   License stages dialogs (they were drawn under the dialog backdrop). */
.fixed.bottom-5.right-5.z-50.pointer-events-none { z-index: 70; }
