/*
 * FlowLift portal stylesheet -- hand-rolled rather than Tailwind CDN (design
 * D4 names Jinja2 + Tailwind; a plan doc separately called Tailwind CDN
 * acceptable for this phase). Task 8 chose a small hand-written stylesheet
 * instead: no external CDN dependency to fetch/trust, no `style-src` origin
 * to allowlist beyond `'self'` (a Tailwind CDN build ships as a `<script>`
 * that injects styles at runtime, which needs its own CSP allowance -- this
 * plain `<link rel="stylesheet">` doesn't), and the surface here is tiny
 * enough that a build step buys nothing. Palette (white background, blue
 * primary, yellow accent) is design D10; Hebrew RTL throughout.
 * Heebo is referenced with a system-ui fallback chain -- it is NOT fetched from
 * a CDN here, so it only renders if the visitor already has it installed
 * locally; the fallback stack carries the page otherwise (same no-external-
 * dependency reasoning as the stylesheet choice above).
 */

:root {
  --flowlift-blue: #1d4ed8;
  --flowlift-blue-dark: #1e3a8a;
  --flowlift-yellow: #facc15;
  --flowlift-ink: #0f172a;
  --flowlift-muted: #64748b;
  --flowlift-border: #e2e8f0;
  --flowlift-bg: #ffffff;
  --flowlift-surface: #f8fafc;
  --flowlift-danger: #dc2626;
  --flowlift-danger-bg: #fef2f2;
  --flowlift-success: #15803d;
  --flowlift-success-bg: #f0fdf4;
  --flowlift-radius: 12px;
  --flowlift-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--flowlift-bg);
  color: var(--flowlift-ink);
  font-family:
    "Heebo",
    system-ui,
    -apple-system,
    "Segoe UI",
    Arial,
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* -- header / footer -------------------------------------------------------- */

.site-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--flowlift-border);
}

/* Brand lockup: the two-tone flame mark + a CSS-styled "FlowLift" wordmark (the
 * text is NOT baked into the SVG). Forced `direction: ltr` so the Latin lockup
 * reads mark-then-name left-to-right even on this RTL page; the lockup as a whole
 * still sits at the RTL start edge (the header's right side). */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  direction: ltr;
}

.wordmark-mark {
  height: 30px;
  width: auto; /* portrait flame mark -- preserve aspect, don't square it */
  display: block;
}

.wordmark-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--flowlift-ink);
}

.site-footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--flowlift-muted);
  font-size: 0.85rem;
}

/* Footer: small muted mark + "FlowLiftAI" (replaces the plain text). Same LTR
 * lockup reasoning as the header wordmark, at a quieter size/opacity. */
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  direction: ltr;
  color: var(--flowlift-muted);
}

.footer-mark {
  height: 20px;
  width: auto; /* portrait flame mark -- preserve aspect */
  display: block;
  opacity: 0.85;
}

/* -- page / card layout ------------------------------------------------------ */

.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--flowlift-bg);
  border: 1px solid var(--flowlift-border);
  border-radius: var(--flowlift-radius);
  box-shadow: var(--flowlift-shadow);
  padding: 2rem;
}

.card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--flowlift-ink);
}

.card .subtitle {
  margin: 0 0 1.5rem;
  color: var(--flowlift-muted);
  font-size: 0.9rem;
}

.card-success h1 {
  color: var(--flowlift-success);
}

.card-error h1 {
  color: var(--flowlift-danger);
}

.success-detail {
  font-size: 1.05rem;
  font-weight: 600;
}

/* "Back to billing" CTA on the card-saved success page (no dead end). Self-contained
 * so it renders outside the .dashboard-scoped button styles. */
.success-back,
.success-back:link,
.success-back:visited {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  background: var(--flowlift-blue);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.success-back:hover {
  background: var(--flowlift-blue-dark);
}

.note {
  color: var(--flowlift-muted);
  font-size: 0.9rem;
}

/* -- form --------------------------------------------------------------------*/

.field {
  margin-bottom: 1rem;
}

fieldset.field-row {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  gap: 0.75rem;
}

fieldset.field-row legend {
  width: 100%;
  padding: 0 0 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--flowlift-ink);
}

fieldset.field-row .field {
  flex: 1;
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--flowlift-ink);
}

input[type="text"],
input[type="tel"],
input[type="email"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--flowlift-surface);
  color: var(--flowlift-ink);
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
  outline: 2px solid var(--flowlift-blue);
  outline-offset: 1px;
  border-color: var(--flowlift-blue);
  background: var(--flowlift-bg);
}

/* Email is edited LTR (the input carries dir="ltr" so the address reads naturally)
 * but stays block-aligned to the RTL start edge, matching the rest of the form. */
input[type="email"] {
  text-align: right;
}

button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--flowlift-blue);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  /* explicit properties only -- never `transition: all` */
  transition:
    background-color 150ms ease,
    transform 120ms ease;
}

/* Tactile press (make-interfaces-feel-better: scale on press, always 0.96). */
button[type="submit"]:active {
  transform: scale(0.96);
}

button[type="submit"]:hover {
  background: var(--flowlift-blue-dark);
}

button[type="submit"]:focus-visible {
  outline: 2px solid var(--flowlift-blue-dark);
  outline-offset: 2px;
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* -- back link (standalone card-entry pages, e.g. /onboard/{token}) --------- */

/* Unobtrusive "go back" link above a standalone card's title -- quiet ghost
 * style (muted, no border/background at rest) so it doesn't compete with the
 * card's primary submit button. The pseudo-element extends the click/touch
 * target to ~40px tall without changing the visible size (same pattern as
 * `.table-action::after` below). */
.back-link,
.back-link:link,
.back-link:visited {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
  color: var(--flowlift-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  /* explicit properties only -- never `transition: all` */
  transition: color 150ms ease;
}

.back-link::after {
  content: "";
  position: absolute;
  inset: -10px 0; /* extend hit area to ~40px tall; no visual/layout change */
}

.back-link-arrow {
  font-size: 1rem;
  line-height: 1;
}

.back-link:hover {
  color: var(--flowlift-blue);
}

.back-link:focus-visible {
  outline: 2px solid var(--flowlift-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* -- banners / errors --------------------------------------------------------*/

.banner {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-align: right;
}

.banner-error,
.og-errors:not(:empty) {
  background: var(--flowlift-danger-bg);
  color: var(--flowlift-danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.banner-success {
  background: var(--flowlift-success-bg);
  color: var(--flowlift-success);
  border: 1px solid rgba(21, 128, 61, 0.25);
}

/* Quiet informational notice -- login page when NO OAuth provider is configured
 * (no email fallback exists anymore, so this points the visitor at FlowLift
 * instead of leaving a dead end). Muted, deliberately un-alarming. */
.banner-notice {
  background: var(--flowlift-surface);
  color: var(--flowlift-muted);
  border: 1px solid var(--flowlift-border);
}

/* Card-required gate -- amber, unmissable, pinned atop the dashboard when no payment
 * method is on file. Stronger than the in-section callout. */
.banner-warn {
  background: #fefce8;
  background: color-mix(in srgb, var(--flowlift-yellow) 15%, #fff);
  color: #854d0e;
  border: 1px solid #fde68a;
  border: 1px solid color-mix(in srgb, var(--flowlift-yellow) 45%, var(--flowlift-border));
}
.card-required {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-required-text {
  margin: 0;
  text-align: right;
}
.card-required form {
  margin: 0;
  flex: none;
}
/* Compact CTA -- override the global full-width submit-button rule inside the banner. */
.card-required button[type="submit"] {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

/* Idle-logout warning modal (static/js/idle-logout.js) -- shown 1 min before the
 * finance-style auto-logout; hidden by default (the script flips display to flex). */
.idle-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.45);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.idle-modal {
  background: var(--flowlift-bg);
  border-radius: var(--flowlift-radius);
  box-shadow: var(--flowlift-shadow);
  padding: 1.5rem 1.75rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.idle-modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  color: var(--flowlift-ink);
}
.idle-modal p {
  margin: 0 0 1.25rem;
  color: var(--flowlift-muted);
}
.idle-modal .idle-count {
  font-weight: 700;
  color: var(--flowlift-ink);
  font-variant-numeric: tabular-nums;
}
.idle-modal .idle-stay {
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--flowlift-blue);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

/* Payment-method removal -- a small, quiet action set well apart from the primary
 * 'replace card' button (higher specificity than the global submit-button rule so the
 * auto width + muted styling win). */
button[type="submit"].removal-request {
  display: block;
  width: auto;
  margin-top: 1.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 8px;
  background: transparent;
  color: var(--flowlift-muted);
  font-size: 0.85rem;
  font-weight: 600;
}
button[type="submit"].removal-request:hover {
  color: var(--flowlift-ink);
  border-color: var(--flowlift-blue);
  background: var(--flowlift-surface);
}
.removal-pending {
  margin-top: 1.1rem;
}

/* Draft / pending-legal-review banner (terms page) -- amber, signals "not final". */
.banner-draft {
  background: #fefce8; /* fallbacks for browsers without color-mix() */
  background: color-mix(in srgb, var(--flowlift-yellow) 15%, #fff);
  color: #854d0e;
  border: 1px solid #fde68a;
  border: 1px solid color-mix(in srgb, var(--flowlift-yellow) 45%, var(--flowlift-border));
  font-weight: 600;
}

.og-errors {
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: right;
}

.og-errors:empty {
  display: none;
}

.error-detail {
  color: var(--flowlift-danger);
  font-size: 1rem;
}

/* -- check-email emblem ------------------------------------------------------ */

.card-emblem {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px; /* concentric: inner 12 vs card 12 - padding 32 keeps the emblem visually nested */
  background: #eef2ff; /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--flowlift-blue) 10%, #fff);
  color: var(--flowlift-blue);
  font-size: 1.5rem;
  line-height: 1;
}

.card h1,
.panel-title,
.dash-title {
  text-wrap: balance;
}

.note a {
  color: var(--flowlift-blue);
  text-decoration: none;
}

.note a:hover {
  text-decoration: underline;
}

/* -- OAuth sign-in (Google / Microsoft) -------------------------------------- */

/* Provider buttons ARE the login now (the email form was removed). Stacked full
 * width in a single column so Google and Microsoft are identical width, height,
 * and font-size -- one uniform control (owner: "can't have these buttons in
 * different sizes"). */
.oauth-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0;
}

.btn-oauth,
.btn-oauth:link,
.btn-oauth:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 44px; /* touch target */
  padding: 0.65rem 1rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 8px;
  background: var(--flowlift-bg);
  color: var(--flowlift-ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  /* explicit properties only -- never `transition: all` */
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.btn-oauth:hover {
  border-color: var(--flowlift-blue);
  background: var(--flowlift-surface);
}

.btn-oauth:focus-visible {
  outline: 2px solid var(--flowlift-blue);
  outline-offset: 2px;
}

.btn-oauth svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* The proven-but-unmatched email echoed on the oauth_unmatched page: keep the
 * address LTR + isolated so it reads naturally inside the RTL sentence. */
.oauth-email {
  unicode-bidi: isolate;
  font-weight: 600;
}

/* "או" separator between the OAuth buttons and the email form: a centred label with a
 * hairline rule filling each side (::before / ::after). */
.signin-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--flowlift-muted);
  font-size: 0.85rem;
}
.signin-divider::before,
.signin-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--flowlift-border);
}

/* Email sign-in: input + CTA stacked full-width, matching the OAuth button column. */
.email-signin {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
}
/* The address reads naturally LTR here (dir="ltr"), overriding the RTL-form default
 * that right-aligns email inputs elsewhere. */
.email-signin input[type="email"] {
  text-align: left;
}
/* Match the outlined .btn-oauth look, but win the cascade against the global filled
 * `button[type="submit"]` rule via the higher-specificity element+class selector. */
button[type="submit"].btn-email {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 0;
  padding: 0.65rem 1rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 8px;
  background: var(--flowlift-bg);
  color: var(--flowlift-ink);
  font-size: 0.95rem;
  font-weight: 600;
}
button[type="submit"].btn-email:hover {
  border-color: var(--flowlift-blue);
  background: var(--flowlift-surface);
}
button[type="submit"].btn-email:focus-visible {
  outline: 2px solid var(--flowlift-blue);
  outline-offset: 2px;
}

/* ===========================================================================
 * Dashboard (Task 9) -- wider, top-aligned layout of stacked panels.
 * Buttons here are scoped under `.dashboard` so they intentionally out-specify
 * the narrow `.card` form's `button[type="submit"]` full-width/yellow-dot rules
 * above (those stay for the login + onboarding cards).
 * =========================================================================== */

.page.page-wide {
  align-items: flex-start;
  padding-top: 2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard {
  width: 100%;
  /* 880px (was 760px): the invoices table gained two amount columns (VAT, gross
   * total) alongside the existing net column -- widened so typical desktop
   * viewports show the full row without falling back to .table-scroll's
   * horizontal scroll, which still covers narrower viewports. */
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* -- header ------------------------------------------------------------------ */

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dash-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--flowlift-blue);
}

.dash-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--flowlift-ink);
}

.dash-nav {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.dash-nav a {
  color: var(--flowlift-muted);
  text-decoration: none;
}

.dash-nav a[aria-current="page"] {
  color: var(--flowlift-ink);
  font-weight: 600;
  border-bottom: 2px solid var(--flowlift-yellow);
  padding-bottom: 2px;
}

/* -- panels ------------------------------------------------------------------ */

.panel {
  background: var(--flowlift-bg);
  border: 1px solid var(--flowlift-border);
  border-radius: 16px; /* outer; nested controls use 8-10px */
  box-shadow: var(--flowlift-shadow);
  padding: 1.5rem;
}

.panel-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--flowlift-ink);
}

/* -- invoices table ---------------------------------------------------------- */

.table-scroll {
  overflow-x: auto; /* wide content scrolls inside its own box, page never does */
  margin: 0 -0.25rem;
}

table.invoices {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

table.invoices th {
  text-align: right;
  font-weight: 600;
  color: var(--flowlift-muted);
  font-size: 0.8rem;
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid var(--flowlift-border);
  white-space: nowrap;
}

table.invoices td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--flowlift-border);
  color: var(--flowlift-ink);
  vertical-align: middle;
}

table.invoices tbody tr:last-child td {
  border-bottom: none;
}

table.invoices tbody tr {
  transition: background-color 150ms ease;
}

table.invoices tbody tr:hover {
  background: var(--flowlift-surface);
}

/* Amounts: LTR + tabular so digits line up regardless of the RTL table around
 * them (make-interfaces-feel-better: tabular numbers). */
.num-col {
  text-align: right;
}

.amount {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Total-due column (gross, net + VAT): heavier weight than the net/VAT columns
 * so the amount the customer actually owes reads as the primary figure in the row. */
.amount-total {
  font-weight: 700;
  color: var(--flowlift-ink);
}

.action-col {
  text-align: left;
  white-space: nowrap;
}

/* -- chips ------------------------------------------------------------------- */

/* ONE chip size for every status (owner: "can't have these ... in different
 * sizes"). Fixed 24px height + inline-flex centering so a status chip, the
 * "בהכנה" chip, and the "פעיל" chip are pixel-identical and line up with the
 * row's action button (which is sized to match). */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem; /* ~12.5px */
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chip-pending {
  background: #fef3c7; /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--flowlift-yellow) 22%, #fff);
  color: #854d0e;
}

.chip-active {
  background: var(--flowlift-success-bg);
  color: var(--flowlift-success);
}

/* Declined run in the payment history -- restrained red, deliberately a notch
 * quieter than --flowlift-danger (used for hard error banners) since this is a
 * routine row state the tenant sees regularly, not an active error to fix now. */
.chip-declined {
  background: #fef2f2; /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, #b91c1c 10%, #fff);
  color: #b91c1c;
}

/* -- buttons (dashboard-scoped) ---------------------------------------------- */

.dashboard .btn,
.dashboard .btn:link,
.dashboard .btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 44px; /* touch target */
  margin: 0;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.925rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  /* explicit properties only -- never `transition: all` */
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.dashboard .btn::after {
  content: none; /* drop the inherited yellow accent dot of the card submit button */
}

.dashboard .btn:active {
  transform: scale(0.96); /* tactile press */
}

.dashboard .btn:focus-visible {
  outline: 2px solid var(--flowlift-blue);
  outline-offset: 2px;
}

.dashboard .btn-primary {
  background: var(--flowlift-blue);
  color: #fff;
}

.dashboard .btn-primary:hover {
  background: var(--flowlift-blue-dark);
}

.dashboard .btn-secondary {
  background: var(--flowlift-bg);
  color: var(--flowlift-blue);
  border-color: var(--flowlift-border);
}

.dashboard .btn-secondary:hover {
  border-color: var(--flowlift-blue);
  background: var(--flowlift-surface);
}

/* Row action button (הורדה) -- a compact ghost button sized to the SAME 24px
 * height as the chips, so every invoices-table row is uniform whether it shows a
 * download button, a "בהכנה" chip, or a dash (owner: the הורדה button and the
 * chips must not differ in size). The visible control stays 24px; a pseudo-element
 * extends the click/touch target vertically to ~42px without changing the layout
 * or the row height. */
.table-action,
.table-action:link,
.table-action:visited {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 0.7rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 8px;
  background: var(--flowlift-surface);
  color: var(--flowlift-blue);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  /* explicit properties only -- never `transition: all` */
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 120ms ease;
}

.table-action::after {
  content: "";
  position: absolute;
  inset: -9px 0; /* extend hit area to ~42px tall; no visual/layout change */
}

.table-action:hover {
  border-color: var(--flowlift-blue);
  background: #eff6ff; /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--flowlift-blue) 6%, #fff);
}

.table-action:active {
  transform: scale(0.96); /* tactile press */
}

.table-action:focus-visible {
  outline: 2px solid var(--flowlift-blue);
  outline-offset: 2px;
}

/* Empty/placeholder table cell dash -- muted, centered by the cell's
 * vertical-align: middle (uniform, quiet dashes across rows). */
.cell-dash {
  color: var(--flowlift-muted);
}

/* -- empty state ------------------------------------------------------------- */

.empty {
  border: 1px dashed var(--flowlift-border);
  border-radius: 12px;
  background: var(--flowlift-surface);
  padding: 1.75rem 1.5rem;
  text-align: center;
}

.empty-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: var(--flowlift-ink);
}

.empty-body {
  margin: 0;
  color: var(--flowlift-muted);
  font-size: 0.9rem;
  text-wrap: pretty;
}

/* -- payment method ---------------------------------------------------------- */

.method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 12px;
  background: var(--flowlift-surface);
}

.method-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.method-mask {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--flowlift-ink);
}

.method-exp {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--flowlift-muted);
}

.callout {
  border: 1px solid #fde68a; /* fallbacks for browsers without color-mix() */
  border: 1px solid color-mix(in srgb, var(--flowlift-yellow) 45%, var(--flowlift-border));
  background: #fefce8;
  background: color-mix(in srgb, var(--flowlift-yellow) 12%, #fff);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.callout-title {
  margin: 0 0 0.3rem;
  font-weight: 700;
  color: var(--flowlift-ink);
}

.callout-body {
  margin: 0;
  color: #854d0e;
  font-size: 0.9rem;
  text-wrap: pretty;
}

/* -- billing email ----------------------------------------------------------- */

.email-display {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
  margin: 0 0 0.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 10px;
  background: var(--flowlift-surface);
  font-weight: 600;
  color: var(--flowlift-ink);
}

@media (max-width: 520px) {
  .dashboard .btn {
    width: 100%;
  }
}

/* -- additional CC recipients (נמענים נוספים לחשבוניות) ----------------------- */

.cc-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 10px;
  background: var(--flowlift-surface);
}

.cc-email {
  unicode-bidi: isolate;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--flowlift-ink);
  overflow-wrap: anywhere;
}

.cc-remove-form {
  margin: 0;
  flex-shrink: 0;
}

button[type="submit"].cc-remove {
  position: relative;
  padding: 0.25rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--flowlift-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition-property: color, background-color, scale;
  transition-duration: 0.15s;
}
/* Extend the small control to a comfortable hit area without growing the visual. */
button[type="submit"].cc-remove::after {
  content: "";
  position: absolute;
  inset: -0.5rem -0.35rem;
}
button[type="submit"].cc-remove:hover {
  color: var(--flowlift-danger);
  background: var(--flowlift-danger-bg);
}
button[type="submit"].cc-remove:active {
  scale: 0.96;
}

.cc-add-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0;
}

.cc-input {
  flex: 1 1 auto;
  min-width: 0;
  direction: ltr;
  text-align: left;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--flowlift-border);
  border-radius: 9px;
  background: var(--flowlift-bg);
  color: var(--flowlift-ink);
  font-size: 0.9rem;
  font-family: inherit;
}
.cc-input:focus {
  outline: none;
  border-color: var(--flowlift-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--flowlift-blue) 15%, transparent);
}

button[type="submit"].cc-add {
  flex-shrink: 0;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--flowlift-blue);
  border-radius: 9px;
  background: var(--flowlift-blue);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition-property: background-color, scale;
  transition-duration: 0.15s;
}
button[type="submit"].cc-add:hover {
  background: var(--flowlift-blue-dark);
}
button[type="submit"].cc-add:active {
  scale: 0.96;
}

.cc-empty {
  margin-top: 0;
  margin-bottom: 0.75rem;
}
.cc-error {
  color: var(--flowlift-danger);
  font-weight: 600;
}

/* -- billing-terms consent (onboarding form) --------------------------------- */

.field-consent {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400; /* body weight -- override the bold `label` default */
  line-height: 1.5;
  color: var(--flowlift-ink);
  cursor: pointer;
  text-wrap: pretty;
}

.consent-label input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 0.15rem; /* optical: align the box with the first line of text */
  accent-color: var(--flowlift-blue);
  cursor: pointer;
}

.consent-label a {
  color: var(--flowlift-blue);
  text-decoration: underline;
}

/* -- legal / terms page ------------------------------------------------------ */

.legal {
  width: 100%;
  max-width: 680px;
  color: var(--flowlift-ink);
}

.legal-title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 700;
  text-wrap: balance;
}

.legal-lead {
  margin: 0 0 1.5rem;
  color: var(--flowlift-muted);
  text-wrap: pretty;
}

.legal-section {
  margin-bottom: 1.5rem;
}

.legal-section h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.legal-section p {
  margin: 0;
  text-wrap: pretty;
}

.legal a {
  color: var(--flowlift-blue);
}

/* -- welcome landing (GET /) ------------------------------------------------- */

/* The single branded front door. Reuses the `.card` shell (same border, radius,
 * shadow, padding) so it stays part of the restrained card system; only a slightly
 * larger headline and a first-time note divider set it apart as a landing. */
.welcome {
  text-align: start;
}

.welcome-title {
  font-size: 1.5rem; /* a touch larger than the login h1 -- this is the front door */
}

/* Center the heading + subline within the card (owner decision, portal-polish-2)
 * -- a front door reads calmer centered. Scoped to just these two elements so
 * the provider buttons and first-time note below keep their RTL block alignment. */
.welcome-title,
.welcome-sub {
  text-align: center;
}

/* Push the sign-in controls a little clear of the subline so the card breathes. */
.welcome .oauth-options,
.welcome .banner-notice {
  margin-top: 1.25rem;
}

/* First-time note: a quiet, separated footnote under the buttons. `.note` (muted,
 * blue links) is inherited from the shared rule above; the divider + pretty-wrap
 * are the only additions. */
.welcome-note {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--flowlift-border);
  text-wrap: pretty;
}

.welcome-note a {
  unicode-bidi: isolate; /* keep the LTR address intact inside the RTL sentence */
  font-weight: 600;
}

/* Gentle, split + staggered entrance for the landing only (skill: split and stagger
 * enter animations). A keyframe that runs once -- not a transition -- and it is only
 * armed under `prefers-reduced-motion: no-preference`, so reduced-motion users get
 * the final state with no movement. `both` holds the from-state pre-delay so nothing
 * flashes at full opacity before its turn. */
@keyframes welcome-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .welcome > * {
    animation: welcome-rise 480ms cubic-bezier(0.2, 0, 0, 1) both;
  }
  .welcome > :nth-child(1) {
    animation-delay: 40ms;
  }
  .welcome > :nth-child(2) {
    animation-delay: 120ms;
  }
  .welcome > :nth-child(3) {
    animation-delay: 200ms;
  }
  .welcome > :nth-child(4) {
    animation-delay: 280ms;
  }
}

/* -- self-service onboarding (signup form) ----------------------------------- */

/* The signup card is a touch wider than the login/onboarding card: it carries the
 * full company-detail set plus the card block, so it needs room without feeling
 * cramped. Still part of the same restrained `.card` system (border, radius, shadow). */
.card.signup {
  max-width: 480px;
}

.signup-title {
  font-size: 1.5rem;
}

/* Optional-field hint next to a label -- muted, lighter weight than the label. */
.field-optional {
  color: var(--flowlift-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

/* Per-field validation message under an invalid input. */
.field-error {
  margin: 0.35rem 0 0;
  color: var(--flowlift-danger);
  font-size: 0.8rem;
  text-wrap: pretty;
}

/* An input flagged invalid gets a danger ring so the error reads at a glance. */
input[aria-invalid="true"] {
  border-color: var(--flowlift-danger);
}

input[aria-invalid="true"]:focus {
  outline-color: var(--flowlift-danger);
  border-color: var(--flowlift-danger);
}

/* A field that should take the remaining width of a `.field-row` (e.g. street
 * address beside nothing, or city beside the narrower zip). */
fieldset.field-row .field.field-grow {
  flex: 1 1 auto;
}

/* Quiet divider between the company detail block and the card block. */
.signup-divider {
  border: none;
  border-top: 1px solid var(--flowlift-border);
  margin: 1.5rem 0 1.25rem;
}

/* Gentle single fade-in for the signup card (forms shouldn't bounce field-by-field;
 * a calm rise of the whole card is enough). Reuses the welcome-rise keyframe. Armed
 * only when the user hasn't asked for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .card.signup {
    animation: welcome-rise 420ms cubic-bezier(0.2, 0, 0, 1) both;
  }
}

/* Respect users who ask for less motion: drop the press-scale + row/hover
 * transitions (they are polish, never load-bearing). */
@media (prefers-reduced-motion: reduce) {
  .dashboard .btn,
  .table-action,
  table.invoices tbody tr {
    transition: none;
  }

  .dashboard .btn:active,
  .table-action:active,
  button[type="submit"]:active {
    transform: none;
  }
}
