/* ==========================================================================
   BILLING — client portal (/billing). Loaded by billing.html only.
   Built on the shared tokens so it follows the light/dark theme like
   every other page.
   ========================================================================== */

/* The portal swaps views with the `hidden` attribute, but author rules such as
   `.form { display: flex }` outrank the browser's own `[hidden] { display:none }`
   and would show both sign-in steps at once. This sheet only loads on
   /billing, so the override cannot affect any other page. */
[hidden] { display: none !important; }

.billing-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 18px);
  background: var(--bg-elev);
  padding: clamp(24px, 4vw, 44px);
}

.billing-panel .form { gap: var(--sp-5); }

.billing-sent {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin: 0;
}
.billing-sent strong { color: var(--text); font-weight: 600; }

.otp-input {
  font-family: var(--font-mono);
  font-size: clamp(22px, 3.2vw, 30px);
  letter-spacing: 0.5em;
  text-align: center;
  padding-left: 0.5em;   /* balances the trailing letter-spacing */
}

.billing-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2, 8px) var(--sp-5);
  font-size: var(--fs-sm);
}
.billing-links button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font: inherit;
}
.billing-links button:hover,
.billing-links button:focus-visible { color: var(--text); }
.billing-links button[disabled] { opacity: 0.45; cursor: default; text-decoration: none; }

.billing-note {
  min-height: 1.4em;
  margin: var(--sp-5) 0 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.billing-note.is-error { color: var(--text); font-weight: 600; }

/* ---- signed-in bar ------------------------------------------------------ */
.billing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-9, 48px);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.billing-bar strong { color: var(--text); font-weight: 600; word-break: break-all; }

.billing-test {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-label, 0.08em);
  text-transform: uppercase;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-xs, 6px);
  padding: 10px 14px;
  margin: 0 0 var(--sp-7, 32px);
  color: var(--text-2);
}

.billing-group + .billing-group { margin-top: var(--sp-9, 56px); }

.billing-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.billing-group__head h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 400;
  margin: 0;
}
.billing-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.billing-list { display: flex; flex-direction: column; gap: var(--sp-3, 12px); }

.billing-empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg, 18px);
  padding: 28px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* ---- an invoice row ----------------------------------------------------- */
.bill {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-5);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 18px);
  background: var(--bg-elev);
  padding: 22px 24px;
  transition: border-color var(--dur-fast, 160ms) var(--ease-out, ease);
}
.bill:hover { border-color: var(--line-strong); }

.bill__meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin: 0 0 6px;
}
.bill__meta .is-overdue { color: var(--text); font-weight: 600; }

.bill__title {
  font-size: var(--fs-body);
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.bill__details {
  margin: 6px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: var(--lh-body, 1.6);
  white-space: pre-line;
}

.bill__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  text-align: right;
}
.bill__amount {
  font-family: var(--font-mono);
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.bill__tax {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: -6px;
}
.bill--paid .bill__amount { color: var(--text-2); }

.bill__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro, 11px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.bill__badge svg { width: 13px; height: 13px; }

@media (max-width: 620px) {
  .bill { grid-template-columns: 1fr; }
  .bill__side { align-items: stretch; text-align: left; }
  .bill__side .btn { width: 100%; justify-content: center; }
}

/* ===================================================================

   UNDER DEVELOPMENT — hero tag + first-visit dialog
   ========================================================================== */

/* The tag is the durable signal: the dialog is dismissed once and gone, this
   stays on the page for the rest of the visit. Used in both places, so it
   carries no margin of its own. */
.dev-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin: 0 0 var(--sp-4);
  padding: 0.45em 0.95em;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-2);
}

.dev-tag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dev-pulse 2.4s var(--ease-in-out) infinite;
}

@keyframes dev-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .dev-tag__dot { animation: none; opacity: 0.8; }
}

/* In the hero it follows the breadcrumb; in the dialog it leads, so the
   breathing room above it belongs to the hero instance only. */
.page-hero .dev-tag { margin-top: var(--sp-3); }

/* ---------------------------------------------------------------- dialog */
.dev-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader, 1100);   /* above the header and the drawer */
  display: grid;
  place-items: center;
  padding: var(--gutter);
}

.dev-modal__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: dev-fade var(--dur, 420ms) var(--ease-out) both;
}

.dev-modal__panel {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100dvh - var(--gutter) * 2);
  overflow-y: auto;
  padding: clamp(26px, 4.5vw, 44px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  animation: dev-rise var(--dur, 420ms) var(--ease-spring) both;
}

/* Focused when the dialog opens so it is announced as a whole. It is a
   container rather than a control and is not reachable by Tab, so it takes no
   focus ring — the buttons inside it keep theirs. */
.dev-modal__panel:focus { outline: none; }

.dev-modal__title {
  margin: 0 0 var(--sp-4);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 500;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.dev-modal__body p {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--text-2);
}
.dev-modal__body p:last-child { margin-bottom: 0; }
.dev-modal__body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;   /* the address is long enough to overflow a phone */
}

.dev-modal__actions { margin-top: var(--sp-6); }
.dev-modal__actions .btn { width: 100%; justify-content: center; }

@keyframes dev-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dev-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dev-modal__scrim,
  .dev-modal__panel { animation: none; }
}

.billing-help {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: var(--lh-body, 1.6);
  color: var(--text-3);
}
.billing-help a { color: var(--text-2); }
