/*
 * Titan Lock — sales.css (new sale + enrolment; the ONLY A4 terms print CSS). Owner: WS5-M3.
 * Registered on every panel by the S0 seam (ConfiguresTitanPanel). Styles only
 * this module's own .tl-* classes (the wizard, the SMS-code block, the plan
 * preview, the enrolment screen, the unfinished-sales card and the printed
 * agreement); panel-specific rules are scoped under .fi-panel-counter. Plain
 * CSS (no Tailwind build). After an edit run `php artisan filament:assets` —
 * the panels serve the published copy in public/css/app/.
 */

/* ── New sale wizard (counter, phone first) ─────────────────────────────── */
.fi-panel-counter .tl-sale-wizard .fi-sc-wizard-header {
  overflow-x: auto;
  scrollbar-width: none;
}
.fi-panel-counter .tl-sale-wizard .fi-sc-wizard-header-step-description {
  display: none;
}
.fi-panel-counter .tl-sale-wizard .fi-sc-wizard-footer .fi-btn {
  min-height: 44px;
}
.tl-sale-terms {
  display: block;
  line-height: 1.5;
}
.tl-key-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--tl-gold-700);
}
.tl-key-note__icon {
  width: 1rem;
  height: 1rem;
  color: var(--tl-gold-600);
  flex: none;
}

/* ── E2: the SMS-code (OTP) block ───────────────────────────────────────── */
.tl-otp {
  padding: 0.75rem;
  border: 1px solid var(--tl-steel-200);
  border-radius: var(--tl-radius-md);
  background: var(--tl-steel-50);
}
.tl-otp__status {
  display: block;
  font-size: 0.875rem;
  color: var(--tl-steel-600);
}
.tl-otp__status--ok {
  color: var(--tl-green-800);
  font-weight: 600;
}
.tl-otp__status--off {
  color: var(--tl-steel-500);
  font-style: italic;
}
.tl-otp__hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--tl-steel-500);
}

/* ── R4 plan preview ────────────────────────────────────────────────────── */
.tl-plan {
  display: grid;
  gap: 0.625rem;
}
.tl-plan__totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem;
  border-radius: var(--tl-radius-md);
  background: var(--tl-steel-50);
}
.tl-plan__totals dt {
  font-size: 0.75rem;
  color: var(--tl-steel-500);
}
.tl-plan__totals dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tl-plan__warning,
.tl-plan__error {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.5rem 0.625rem;
  border-radius: var(--tl-radius-sm);
  font-size: 0.8125rem;
}
.tl-plan__warning {
  background: var(--tl-warn-bg);
  color: var(--tl-warn-fg);
}
.tl-plan__error {
  background: var(--tl-lock-bg);
  color: var(--tl-lock-fg);
}
.tl-plan__icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  margin-top: 0.1rem;
}
.tl-plan__schedule summary {
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
}
.tl-plan__schedule ol {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}
.tl-plan__schedule li {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px dashed var(--tl-steel-200);
  font-size: 0.8125rem;
}
.tl-plan__ladder {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}
.tl-plan__ladder-title {
  width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tl-steel-600);
}

/* ── R6 / R7 enrolment ──────────────────────────────────────────────────── */
.tl-enroll {
  display: grid;
  gap: 1rem;
}
.tl-enroll__who {
  display: grid;
  gap: 0.125rem;
}
.tl-enroll__name {
  font-weight: 700;
  font-size: 1rem;
}
.tl-enroll__blocked {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px dashed var(--tl-steel-300);
  border-radius: var(--tl-radius-md);
  background: var(--tl-steel-50);
  color: var(--tl-steel-600);
}
.tl-enroll__blocked p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
}
.tl-enroll__blocked-icon {
  width: 2rem;
  height: 2rem;
  flex: none;
  color: var(--tl-steel-400);
}
.tl-enroll__blocked-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--tl-ink-900);
}
.tl-enroll__code {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}
.tl-enroll__code--expired .tl-qr {
  opacity: 0.15;
}
.tl-enroll__countdown {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tl-enroll__countdown-icon {
  width: 1rem;
  height: 1rem;
}
.tl-qr {
  margin: 0;
  width: min(100%, 18rem);
  padding: 0.5rem;
  background: var(--tl-white);
  border-radius: var(--tl-radius-md);
  box-shadow: var(--tl-shadow-1);
}
.tl-qr--small {
  width: min(100%, 10rem);
}
.tl-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.tl-qr figcaption {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
  text-align: center;
}
.tl-qr__svg .dark,
.tl-print-terms__qr-svg .dark {
  fill: var(--tl-ink-950);
}
.tl-enroll__steps {
  width: 100%;
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  display: grid;
  gap: 0.375rem;
}
.tl-enroll__adb {
  width: 100%;
  display: grid;
  gap: 0.75rem;
}
.tl-enroll__adb-caveat {
  margin: 0;
  padding: 0.5rem 0.625rem;
  border-radius: var(--tl-radius-sm);
  background: var(--tl-remind-bg);
  color: var(--tl-remind-fg);
  font-size: 0.8125rem;
}
.tl-enroll__cmd {
  margin: 0;
  padding: 0.75rem;
  overflow-x: auto;
  border-radius: var(--tl-radius-sm);
  background: var(--tl-ink-900);
  color: var(--tl-green-100);
  font-family: var(--tl-font-code);
  font-size: 0.75rem;
  white-space: pre;
}
.tl-enroll__token {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.tl-enroll__token-label {
  width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
}
.tl-enroll__token-value {
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}

/* Live enrolment status (App\Livewire\Sales\EnrollmentStatus) */
.tl-enroll-status {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--tl-steel-200);
  border-radius: var(--tl-radius-md);
}
.tl-enroll-status__title {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
}
.tl-enroll-status__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
.tl-enroll-status__step {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  font-size: 0.875rem;
}
.tl-enroll-status__icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}
.tl-enroll-status__step--done {
  color: var(--tl-green-800);
}
.tl-enroll-status__step--now {
  color: var(--tl-ink-900);
  font-weight: 600;
}
.tl-enroll-status__step--waiting,
.tl-enroll-status__step--pending {
  color: var(--tl-steel-500);
}
.tl-enroll-status__done {
  font-size: 0.75rem;
}

/* ── Counter home: unfinished sales ─────────────────────────────────────── */
.tl-drafts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
.tl-drafts__row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--tl-steel-100);
}
.tl-drafts__main {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}
.tl-drafts__name {
  font-weight: 600;
}
.tl-drafts__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.tl-drafts__chips .tl-chip {
  white-space: normal;
}

/* ── The printed agreement (A4) ─────────────────────────────────────────── */
.tl-print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.tl-print-terms {
  max-width: 50rem;
  padding: 1.5rem;
  background: var(--tl-white);
  border: 1px solid var(--tl-steel-200);
  border-radius: var(--tl-radius-md);
  color: var(--tl-ink-950);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.tl-print-terms__header,
.tl-print-terms__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8125rem;
}
.tl-print-terms__header {
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--tl-ink-900);
}
.tl-print-terms__brand {
  font-weight: 800;
}
.tl-print-terms__body h1 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 1rem 0 0.5rem;
}
.tl-print-terms__body h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 0.375rem;
}
.tl-print-terms__body p,
.tl-print-terms__body ul,
.tl-print-terms__body ol {
  margin: 0.375rem 0;
}
.tl-print-terms__body ul,
.tl-print-terms__body ol {
  padding-left: 1.25rem;
}
.tl-print-terms__body ul {
  list-style: disc;
}
.tl-print-terms__body ol {
  list-style: decimal;
}
.tl-print-terms__fingerprint {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding: 0.75rem;
  border: 1px solid var(--tl-ink-900);
  border-radius: var(--tl-radius-sm);
  break-inside: avoid;
}
.tl-print-terms__fingerprint h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
}
.tl-print-terms__fingerprint p {
  margin: 0.25rem 0 0;
}
.tl-print-terms__hash {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.625rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tl-print-terms__qr {
  margin: 0;
  width: 7.5rem;
  flex: none;
}
.tl-print-terms__qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.tl-print-terms__signatures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  font-size: 0.8125rem;
  break-inside: avoid;
}
.tl-print-terms__line {
  display: block;
  height: 2.5rem;
  border-bottom: 1px solid var(--tl-ink-950);
  margin-bottom: 0.25rem;
}
.tl-print-terms__footer {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--tl-steel-300);
  color: var(--tl-steel-600);
}

/* A NAMED page: A4 applies only to the agreement, never to other prints (WS6's 80-mm receipt). */
@page tl-terms {
  size: A4;
  margin: 14mm 14mm 16mm;
}
.tl-print-terms {
  page: tl-terms;
}

@media print {
  /* Only the agreement prints, on a page that contains it (receipts print through collections.css). */
  body:has(.tl-print-terms) * {
    visibility: hidden;
  }
  body:has(.tl-print-terms) .tl-print-terms,
  body:has(.tl-print-terms) .tl-print-terms * {
    visibility: visible;
  }
  body:has(.tl-print-terms) .tl-print-terms {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    font-size: 10.5pt;
  }
  body:has(.tl-print-terms) .tl-print-actions,
  body:has(.tl-print-terms) .tl-print-terms__screen-only {
    display: none;
  }
  .tl-print-terms__body h2 {
    break-after: avoid;
  }
}
