/* Simple Store tenant portal.
   Brand tokens defined once here -- swap these five values to rebrand. */
:root {
  --ss-primary: #086590;
  --ss-primary-dark: #064E6E;
  --ss-bone: #F7F4EC;
  --ss-brass: #B08D57;
  --ss-ink: #1A1A1A;

  /* Derived neutrals, not part of the brand spec -- exist only to give
     cards/borders something to sit on without inventing off-brand color. */
  --ss-white: #FFFFFF;
  /* Card/component surface color -- deliberately its own token, not reused
     from --ss-white directly: every "background: var(--ss-surface)" below
     is themeable (see staff/static/staff/css/staff.css's dark theme, which
     overrides this alone), while "color: var(--ss-white)" (literal white
     text on a colored background, e.g. a button/hero/chat bubble) must
     stay real white regardless of theme -- collapsing the two into one
     token would make a dark theme override either break card surfaces or
     wrongly darken white-on-color text. Defaults to --ss-white, so this is
     a no-op for the portal itself. */
  --ss-surface: var(--ss-white);
  --ss-border: #E3DDCB;
  --ss-muted: #6B6B62;
  --ss-danger: #8A3B2B;

  /* Brass/primary tints for soft fills (badges, hover washes) without
     ever needing a fully-opaque off-brand color. */
  --ss-brass-tint: rgba(176, 141, 87, 0.10);
  --ss-brass-tint-strong: rgba(176, 141, 87, 0.22);
  --ss-primary-tint: rgba(8, 101, 144, 0.06);
  --ss-primary-tint-strong: rgba(8, 101, 144, 0.12);
  --ss-neutral-tint: rgba(26, 26, 26, 0.06);

  /* Type */
  --ss-font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ss-font-sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing scale -- everything on this rhythm. */
  --ss-space-1: 0.25rem;
  --ss-space-2: 0.5rem;
  --ss-space-3: 0.75rem;
  --ss-space-4: 1rem;
  --ss-space-5: 1.5rem;
  --ss-space-6: 2rem;
  --ss-space-7: 3rem;
  --ss-space-8: 4rem;

  --ss-radius: 16px;
  --ss-radius-sm: 10px;
  --ss-radius-pill: 999px;

  /* Tinted to --ss-primary-dark (6, 78, 110) rather than flat black --
     shadows should carry the brand's hue, not read as generic UI-kit
     gray. */
  --ss-shadow-sm: 0 1px 2px rgba(6, 78, 110, 0.06), 0 1px 1px rgba(6, 78, 110, 0.04);
  --ss-shadow-md: 0 8px 20px rgba(6, 78, 110, 0.10), 0 2px 6px rgba(6, 78, 110, 0.05);
  --ss-shadow-lg: 0 28px 56px rgba(6, 78, 110, 0.16), 0 8px 16px rgba(6, 78, 110, 0.07);

  --ss-transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

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

body {
  background-color: var(--ss-bone);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, var(--ss-primary-tint), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, var(--ss-brass-tint), transparent 55%);
  background-attachment: fixed;
  color: var(--ss-ink);
  font-family: var(--ss-font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Every dollar figure and unit number on this site is a fixed-width
     accounting figure -- digits should line up in a column instead of
     jittering as they change (a balance updating, prices in a list). */
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
  font-family: var(--ss-font-serif);
  font-weight: 600;
  color: var(--ss-ink);
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--ss-primary);
  transition: color var(--ss-transition);
}

a:hover {
  color: var(--ss-primary-dark);
}

:focus-visible {
  outline: 2px solid var(--ss-primary);
  outline-offset: 2px;
}

/* Small-caps / letter-spaced label style, used for section titles and
   dt labels throughout -- the "editorial statement" texture. */
.ss-label {
  font-family: var(--ss-font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ss-muted);
}

/* ---------- Header ---------- */

.ss-header {
  background: var(--ss-surface);
  border-bottom: 1px solid var(--ss-border);
  position: relative;
}

.ss-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--ss-brass), transparent 40%);
  opacity: 0.6;
}

.ss-header__inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ss-space-4);
  padding: var(--ss-space-4) var(--ss-space-5);
}

.ss-header__brand {
  display: flex;
  align-items: center;
  gap: var(--ss-space-3);
  min-width: 0;
}

.ss-header__logo {
  height: 40px;
  width: auto;
  display: block;
}

.ss-header__nav {
  display: flex;
  align-items: center;
  gap: var(--ss-space-5);
  font-size: 0.92rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ss-header__identity {
  display: flex;
  align-items: center;
  gap: var(--ss-space-2);
  min-width: 0;
}

.ss-header__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ss-primary);
  color: var(--ss-white);
  font-family: var(--ss-font-serif);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.ss-header__tenant-name {
  color: var(--ss-muted);
  font-family: var(--ss-font-serif);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.ss-nav-link {
  color: var(--ss-ink);
  text-decoration: none;
  font-weight: 500;
  padding: 0.3rem 0.05rem;
  border-bottom: 2px solid transparent;
  transition: color var(--ss-transition), border-color var(--ss-transition);
}

.ss-nav-link:hover {
  color: var(--ss-primary);
  border-bottom-color: var(--ss-border);
}

.ss-nav-link.is-active {
  color: var(--ss-primary);
  border-bottom-color: var(--ss-brass);
}

.ss-logout-form {
  display: inline-flex;
}

.ss-nav-link--button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

/* ---------- Layout ---------- */

.ss-main {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--ss-space-6) var(--ss-space-5) var(--ss-space-8);
}

.ss-page-title {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin-bottom: var(--ss-space-6);
}

.ss-card {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  box-shadow: var(--ss-shadow-sm);
  padding: var(--ss-space-5);
  margin-bottom: var(--ss-space-5);
}

/* ---------- Balance hero ---------- */

.ss-hero {
  position: relative;
  text-align: center;
  padding: var(--ss-space-7) var(--ss-space-5);
  margin-bottom: var(--ss-space-7);
  border-radius: var(--ss-radius);
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  box-shadow: var(--ss-shadow-lg);
  overflow: hidden;
}

.ss-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ss-brass), var(--ss-primary));
}

.ss-hero::after {
  content: "";
  position: absolute;
  top: -30%;
  left: 50%;
  width: 480px;
  height: 320px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--ss-brass-tint-strong), transparent 70%);
  pointer-events: none;
}

.ss-hero__icon {
  position: relative;
  margin: 0 auto var(--ss-space-4);
}

.ss-hero__label {
  position: relative;
  margin: 0 0 var(--ss-space-3);
}

.ss-hero__figure {
  position: relative;
  font-family: var(--ss-font-serif);
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 600;
  color: var(--ss-brass);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.ss-hero__figure--paid {
  color: var(--ss-primary);
}

.ss-hero__rule {
  position: relative;
  width: 48px;
  height: 2px;
  margin: var(--ss-space-5) auto;
  background: var(--ss-border);
}

.ss-hero__actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--ss-space-3);
}

/* ---------- Sections ---------- */

.ss-section-title {
  margin: 0 0 var(--ss-space-4);
}

/* ---------- Icon chips ----------
   Small tinted chip carrying a 24x24 stroke icon (same visual language as
   the staff console's inline SVGs -- stroke-width 1.8, currentColor). One
   deliberate spot of real color per row/card, not decoration everywhere:
   the default is primary-tinted, modifiers recolor it to match whatever
   state the row is actually reporting (a charge vs. a payment, a balance
   due vs. paid in full). */
.ss-icon-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ss-primary-tint-strong);
  color: var(--ss-primary);
}

.ss-icon-chip svg {
  width: 18px;
  height: 18px;
}

.ss-icon-chip--brass {
  background: var(--ss-brass-tint-strong);
  color: var(--ss-brass);
}

.ss-icon-chip--neutral {
  background: var(--ss-neutral-tint);
  color: var(--ss-muted);
}

.ss-icon-chip--sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.ss-icon-chip--sm svg {
  width: 15px;
  height: 15px;
}

.ss-icon-chip--lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.ss-icon-chip--lg svg {
  width: 24px;
  height: 24px;
}

/* ---------- Empty states ----------
   A single muted line of text reads as an oversight, not a designed
   state. A centered icon chip + heading + one line of context reads as
   "there's genuinely nothing here yet," which is a real, intentional UI
   state worth designing for. */
.ss-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--ss-space-3);
  padding: var(--ss-space-6) var(--ss-space-4);
  color: var(--ss-muted);
}

.ss-empty-state__title {
  font-family: var(--ss-font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ss-ink);
}

.ss-empty-state p {
  margin: 0;
  max-width: 34ch;
  font-size: 0.92rem;
}

/* ---------- Unit cards ---------- */

.ss-unit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ss-space-4);
}

@media (min-width: 640px) {
  .ss-unit-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ss-unit-grid .ss-empty-state {
  grid-column: 1 / -1;
}

.ss-gate-code-card {
  display: flex;
  align-items: center;
  gap: var(--ss-space-4);
}

.ss-gate-code-card__value {
  margin: 0.15rem 0 0;
  font-family: var(--ss-font-serif);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  color: var(--ss-ink);
}

.ss-unit-card {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  box-shadow: var(--ss-shadow-sm);
  padding: var(--ss-space-5);
  display: block;
  text-decoration: none;
  color: var(--ss-ink);
  transition: transform var(--ss-transition), box-shadow var(--ss-transition), border-color var(--ss-transition);
}

.ss-unit-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--ss-shadow-md);
  border-color: var(--ss-brass);
}

.ss-unit-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--ss-space-4);
  padding-bottom: var(--ss-space-3);
  border-bottom: 1px solid var(--ss-border);
}

.ss-unit-card__identity {
  display: flex;
  align-items: center;
  gap: var(--ss-space-3);
}

.ss-unit-card__unit-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ss-unit-card__unit {
  font-family: var(--ss-font-serif);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--ss-ink);
  line-height: 1.1;
}

.ss-unit-card__balance {
  font-family: var(--ss-font-serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ss-brass);
  background: var(--ss-brass-tint);
  padding: 0.25rem 0.7rem;
  border-radius: var(--ss-radius-pill);
  white-space: nowrap;
}

.ss-unit-card__balance--credit {
  color: var(--ss-primary-dark);
  background: var(--ss-primary-tint);
}

.ss-unit-card__balance--paid {
  color: var(--ss-muted);
  background: transparent;
  border: 1px solid var(--ss-border);
}

.ss-unit-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--ss-space-2) var(--ss-space-3);
  font-size: 0.92rem;
}

.ss-unit-card dt {
  color: var(--ss-muted);
}

.ss-unit-card dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
}

.ss-unit-card__footer {
  margin-top: var(--ss-space-3);
  padding-top: var(--ss-space-3);
  border-top: 1px solid var(--ss-border);
}

/* ---------- Autopay badge ---------- */

.ss-autopay-badge {
  display: inline-block;
  font-family: var(--ss-font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ss-muted);
  background: var(--ss-bone);
  border: 1px solid var(--ss-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--ss-radius-pill);
}

.ss-autopay-badge--on {
  color: var(--ss-primary-dark);
  background: var(--ss-primary-tint);
  border-color: transparent;
}

/* ---------- Buttons ---------- */

.ss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  border: 1px solid transparent;
  border-radius: var(--ss-radius-sm);
  padding: 0.8rem 1.75rem;
  font-family: var(--ss-font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color var(--ss-transition), color var(--ss-transition),
    border-color var(--ss-transition), transform var(--ss-transition), box-shadow var(--ss-transition);
}

.ss-btn-primary {
  background: var(--ss-primary);
  color: var(--ss-white);
  box-shadow: var(--ss-shadow-sm);
}

.ss-btn-primary:hover {
  background: var(--ss-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--ss-shadow-md);
}

.ss-btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--ss-shadow-sm);
}

.ss-btn-secondary {
  background: var(--ss-surface);
  color: var(--ss-primary);
  border-color: var(--ss-primary);
}

.ss-btn-secondary:hover {
  background: var(--ss-primary-tint);
  transform: translateY(-1px);
}

.ss-btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

.ss-btn-danger {
  background: var(--ss-danger);
  color: var(--ss-white);
  box-shadow: var(--ss-shadow-sm);
}

.ss-btn-danger:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
  box-shadow: var(--ss-shadow-md);
}

.ss-btn-danger:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--ss-shadow-sm);
}

/* Lease-document-on-file indicator (staff/tenant_detail.html's Rentals
   cards) -- .ss-danger is a brick red meant for text/borders, not a
   filled dot, so this pairs it with an explicit green rather than
   introducing a whole new token pair for one indicator. */
.ss-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  color: var(--ss-white);
  font-size: 0.75rem;
  line-height: 1;
  margin-right: 0.35em;
}

.ss-status-icon--yes {
  background: #2e7d46;
}

.ss-status-icon--no {
  background: var(--ss-danger);
}

.ss-fine-print {
  font-size: 0.78rem;
  color: var(--ss-muted);
  margin: var(--ss-space-2) 0;
}

.ss-btn[disabled] {
  background: var(--ss-brass-tint);
  color: var(--ss-brass);
  border-color: var(--ss-brass-tint-strong);
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.ss-btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ss-space-3);
  margin-top: var(--ss-space-4);
}

.ss-badge-soon {
  display: inline-block;
  background: var(--ss-surface);
  border: 1px solid var(--ss-brass-tint-strong);
  color: var(--ss-brass);
  font-family: var(--ss-font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem;
  border-radius: var(--ss-radius-pill);
}

.ss-badge-count {
  display: inline-block;
  min-width: 1.1em;
  padding: 0.05em 0.4em;
  border-radius: var(--ss-radius-pill);
  background: var(--ss-primary);
  color: var(--ss-white);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}

/* ---------- Messages ---------- */

.ss-thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ss-thread-list li + li {
  border-top: 1px solid var(--ss-border);
}

.ss-thread-list__row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem var(--ss-space-4);
  padding: var(--ss-space-3) 0.1rem;
  text-decoration: none;
  color: inherit;
}

.ss-thread-list__row.is-unread .ss-thread-list__subject {
  font-weight: 700;
}

.ss-thread-list__subject {
  font-weight: 600;
}

.ss-thread-list__snippet {
  grid-column: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-thread-list__meta {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.ss-message-thread {
  display: flex;
  flex-direction: column;
  gap: var(--ss-space-4);
  max-height: 480px;
  overflow-y: auto;
}

.ss-message {
  max-width: 80%;
  padding: var(--ss-space-3) var(--ss-space-4);
  border-radius: var(--ss-radius-sm);
  border: 1px solid var(--ss-border);
}

.ss-message--tenant {
  align-self: flex-end;
  background: var(--ss-primary-tint);
  border-color: var(--ss-primary-tint);
}

.ss-message--staff {
  align-self: flex-start;
  background: var(--ss-surface);
}

.ss-message__meta {
  display: flex;
  justify-content: space-between;
  gap: var(--ss-space-4);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.ss-message__body {
  margin: 0;
  white-space: pre-wrap;
}

/* ---------- Detail lists ---------- */

.ss-back-link {
  display: inline-block;
  margin-bottom: var(--ss-space-4);
  font-size: 0.9rem;
  font-weight: 500;
}

dl.ss-detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--ss-space-3) var(--ss-space-5);
  align-items: baseline;
}

dl.ss-detail-list dt {
  color: var(--ss-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

dl.ss-detail-list dd {
  margin: 0;
  font-size: 1.02rem;
}

/* ---------- Unit detail balance ---------- */

.ss-icon-row {
  display: flex;
  align-items: center;
  gap: var(--ss-space-4);
}

.ss-unit-detail__balance-row {
  margin-bottom: var(--ss-space-5);
  padding-bottom: var(--ss-space-4);
  border-bottom: 1px solid var(--ss-border);
}

.ss-unit-detail__balance-figure {
  margin: 0.15rem 0 0;
  font-family: var(--ss-font-serif);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--ss-primary-dark);
  line-height: 1.1;
}

.ss-unit-detail__balance-figure--due {
  color: var(--ss-brass);
}

.ss-unit-detail__balance-figure--paid {
  color: var(--ss-muted);
}

.ss-unit-detail__lease-note {
  margin: 0 0 var(--ss-space-3);
}

/* ---------- Activity list (recent ledger entries, unit detail) ---------- */

.ss-activity-list {
  list-style: none;
  margin: 0 0 var(--ss-space-3);
  padding: 0;
}

.ss-activity-list__row {
  display: flex;
  align-items: center;
  gap: var(--ss-space-3);
  padding: var(--ss-space-3) 0.1rem;
}

.ss-activity-list__body {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--ss-space-4);
}

.ss-activity-list__row + .ss-activity-list__row {
  border-top: 1px solid var(--ss-border);
}

.ss-activity-list__desc {
  font-weight: 500;
}

.ss-activity-list__date {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ss-muted);
}

.ss-activity-list__amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ss-primary-dark);
  white-space: nowrap;
}

.ss-activity-list__amount--charge {
  color: var(--ss-ink);
}

.ss-activity-list__more {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Tabs (Alpine-driven, e.g. Account page) ---------- */

[x-cloak] {
  display: none !important;
}

.ss-tab-strip {
  display: flex;
  gap: var(--ss-space-1);
  border-bottom: 1px solid var(--ss-border);
  margin-bottom: var(--ss-space-5);
}

.ss-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ss-font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ss-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--ss-space-3) var(--ss-space-2);
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--ss-transition), border-color var(--ss-transition);
}

.ss-tab svg {
  width: 16px;
  height: 16px;
  opacity: 0.75;
}

.ss-tab:hover {
  color: var(--ss-ink);
}

.ss-tab.is-active {
  color: var(--ss-primary);
  border-bottom-color: var(--ss-brass);
}

/* .ss-tab is also reused as a plain <a> for server-navigated toggles
   (e.g. the billing ledger's unit switcher), not just Alpine x-show tabs. */
a.ss-tab {
  text-decoration: none;
}

.ss-tab-panel .ss-card + .ss-card {
  margin-top: var(--ss-space-4);
}

/* ---------- Checkboxes and payment methods (Account page) ---------- */

.ss-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--ss-space-2);
  font-family: var(--ss-font-sans);
  font-size: 0.95rem;
  cursor: pointer;
}

.ss-checkbox-label input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--ss-primary);
}

.ss-autopay-row + .ss-autopay-row {
  margin-top: var(--ss-space-3);
}

.ss-payment-method-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ss-payment-method-list__row {
  display: flex;
  align-items: center;
  gap: var(--ss-space-3);
  padding: var(--ss-space-3) 0.1rem;
}

.ss-payment-method-list__label {
  flex: 1;
  min-width: 0;
}

.ss-payment-method-list__row + .ss-payment-method-list__row {
  border-top: 1px solid var(--ss-border);
}

.ss-payment-method-list__actions {
  display: flex;
  gap: var(--ss-space-2);
}

.ss-payment-element {
  margin-bottom: var(--ss-space-5);
}

.ss-hidden {
  display: none;
}

/* ---------- Auth pages ---------- */

.ss-auth-shell {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--ss-space-7) var(--ss-space-5) var(--ss-space-6);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.ss-auth-shell .ss-header__logo {
  height: 52px;
  display: block;
  margin: 0 auto var(--ss-space-6);
}

.ss-auth-card {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  box-shadow: var(--ss-shadow-lg);
  padding: var(--ss-space-6) var(--ss-space-5);
  position: relative;
  overflow: hidden;
}

.ss-auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ss-brass), var(--ss-primary));
}

.ss-auth-card h1 {
  font-size: 1.6rem;
  margin-bottom: var(--ss-space-2);
}

.ss-auth-card > p:first-of-type {
  margin-top: 0;
}

.ss-form p {
  margin: 0 0 var(--ss-space-4);
}

/* ---------- Live password requirements checklist ---------- */

.ss-pw-requirements {
  list-style: none;
  margin: -0.5rem 0 var(--ss-space-4);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ss-pw-requirement {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ss-danger);
  transition: color var(--ss-transition);
}

.ss-pw-requirement__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}

.ss-pw-requirement__icon::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ss-white);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center/60% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center/60% no-repeat;
}

.ss-pw-requirement.is-met {
  color: var(--ss-primary-dark);
}

.ss-pw-requirement.is-met .ss-pw-requirement__icon::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") center/60% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") center/60% no-repeat;
}

.ss-form label {
  display: block;
  font-family: var(--ss-font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ss-muted);
  margin-bottom: 0.4rem;
}

.ss-form input,
.ss-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-sm);
  font-family: var(--ss-font-sans);
  font-size: 1rem;
  background: var(--ss-bone);
  color: var(--ss-ink);
  transition: border-color var(--ss-transition), box-shadow var(--ss-transition), background-color var(--ss-transition);
}

.ss-form textarea {
  display: block;
  margin-bottom: var(--ss-space-4);
  resize: vertical;
}

.ss-form input:focus,
.ss-form textarea:focus {
  outline: none;
  border-color: var(--ss-primary);
  background: var(--ss-surface);
  box-shadow: 0 0 0 3px var(--ss-primary-tint);
}

.ss-form .ss-btn {
  width: 100%;
}

.ss-form .ss-btn-row .ss-btn {
  width: auto;
}

.ss-document-text {
  /* Viewport-relative, not a fixed px height -- a full lease agreement
     runs to dozens of sections, and a tenant reviewing it needs to see
     more than a few lines at a time before signing. */
  max-height: 70vh;
  min-height: 420px;
  overflow-y: auto;
  padding: var(--ss-space-5);
  margin-bottom: var(--ss-space-5);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-sm);
  background: var(--ss-surface);
  font-size: 1rem;
  position: relative; /* anchors the guided-tour field highlight */
}

/* The signing page needs more horizontal room than an ordinary portal
   page (a full lease is dense, multi-column-ish legal text) -- see
   portal/base.html's main_class block and esign/templates/esign/sign.html. */
.ss-main--wide {
  max-width: 1100px;
}

.ss-main--wide .rental-agreement {
  max-width: 900px;
}

.ss-document-text pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--ss-font-sans);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ---------- Guided signing tour (esign/templates/esign/sign.html) ---------- */

.ss-guide-btn {
  position: fixed;
  top: 96px;
  left: 24px;
  z-index: 40;
  padding: 0.65rem 1.1rem;
  font-family: var(--ss-font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ss-white);
  background: var(--ss-primary);
  border: none;
  border-radius: 999px;
  box-shadow: var(--ss-shadow-sm);
  cursor: pointer;
}

.ss-guide-btn:hover {
  filter: brightness(1.08);
}

@media (max-width: 480px) {
  .ss-guide-btn {
    top: auto;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Briefly marks the field the guided tour just scrolled to. */
.ss-guide-highlight {
  outline: 2px solid var(--ss-brass);
  outline-offset: 2px;
  border-radius: var(--ss-radius-sm);
}

.ss-signature-canvas {
  display: block;
  width: 100%;
  max-width: 600px;
  height: 160px;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-sm);
  background: var(--ss-surface);
  touch-action: none;
  cursor: crosshair;
}

.ss-errorlist {
  list-style: none;
  padding: 0.75rem 1rem;
  margin: 0 0 var(--ss-space-4);
  color: var(--ss-danger);
  background: rgba(138, 59, 43, 0.06);
  border: 1px solid rgba(138, 59, 43, 0.2);
  border-radius: var(--ss-radius-sm);
  font-size: 0.9rem;
}

.ss-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ss-space-3);
  padding: 0.85rem 1rem;
  margin: 0 0 var(--ss-space-5);
  color: var(--ss-danger);
  background: rgba(138, 59, 43, 0.06);
  border: 1px solid rgba(138, 59, 43, 0.2);
  border-radius: var(--ss-radius-sm);
}

.ss-banner p {
  margin: 0;
}

.ss-auth-footer {
  text-align: center;
  margin-top: var(--ss-space-5);
  font-size: 0.9rem;
}

.ss-muted {
  color: var(--ss-muted);
}

.ss-successbox {
  list-style: none;
  padding: 0.75rem 1rem;
  margin: 0 0 var(--ss-space-4);
  color: #2e5e2e;
  background: rgba(46, 94, 46, 0.06);
  border: 1px solid rgba(46, 94, 46, 0.2);
  border-radius: var(--ss-radius-sm);
  font-size: 0.9rem;
}

/* ---------- Statement / ledger table ---------- */

.ss-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ss-table th,
.ss-table td {
  text-align: left;
  padding: var(--ss-space-2) var(--ss-space-3);
  border-bottom: 1px solid var(--ss-border);
}

.ss-table th {
  color: var(--ss-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ss-table td:nth-child(4),
.ss-table td:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Rental agreement (esign) ---------- */
/* Structural only, per templates/leases/rental_agreement.html's own
   header note -- reuses the same tokens/fonts as the rest of the portal,
   no competing palette. */

.rental-agreement {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--ss-font-sans);
  color: var(--ss-ink);
  line-height: 1.55;
}

.rental-agreement h1 {
  font-family: var(--ss-font-serif);
  margin-top: var(--ss-space-3);
}

.rental-agreement h2 {
  font-family: var(--ss-font-serif);
  margin-top: var(--ss-space-6);
}

.rental-agreement section {
  margin-bottom: var(--ss-space-6);
}

.rental-agreement .facility-header {
  text-align: center;
  border-bottom: 1px solid var(--ss-border);
  padding-bottom: var(--ss-space-4);
  margin-bottom: var(--ss-space-5);
}

.rental-agreement .notice-to-tenant,
.rental-agreement .notice-of-lien {
  background: var(--ss-bone);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-sm);
  padding: var(--ss-space-4);
  font-weight: 600;
}

.ss-initial-input,
.ss-text-input {
  font-family: inherit;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-sm);
  padding: 0.2rem 0.5rem;
}

.ss-initial-input {
  width: 5rem;
  text-align: center;
}

.ss-text-input {
  width: 16rem;
  max-width: 100%;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
  .ss-header__inner {
    justify-content: center;
    text-align: center;
  }

  .ss-header__nav {
    justify-content: center;
    width: 100%;
    gap: var(--ss-space-4);
  }

  .ss-main {
    padding: var(--ss-space-5) var(--ss-space-4) var(--ss-space-7);
  }

  .ss-hero {
    padding: var(--ss-space-6) var(--ss-space-4);
  }

  .ss-auth-shell {
    padding-top: var(--ss-space-6);
  }
}

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

/* ---------- Tenant chat widget ---------- */
/* Ported verbatim from public/static/public/css/site.css's .chat-widget
   block -- same --ss-* brand tokens exist in both stylesheets, so this is
   the identical widget shape, just living in the portal's own CSS file
   rather than creating a cross-app static-file dependency. */

.chat-widget {
  position: fixed;
  right: var(--ss-space-5);
  bottom: var(--ss-space-5);
  z-index: 60;
}

.chat-widget__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--ss-space-2);
  border: none;
  border-radius: var(--ss-radius-pill);
  background: var(--ss-primary);
  color: var(--ss-white);
  padding: 0.9rem 1.4rem;
  font-family: var(--ss-font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--ss-shadow-lg);
  transition: background-color var(--ss-transition), transform var(--ss-transition);
}

.chat-widget__toggle:hover {
  background: var(--ss-primary-dark);
  transform: translateY(-1px);
}

.chat-widget__toggle-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--ss-space-3));
  width: min(360px, calc(100vw - 2 * var(--ss-space-5)));
  max-height: min(560px, 75vh);
  display: flex;
  flex-direction: column;
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  box-shadow: var(--ss-shadow-lg);
  overflow: hidden;
}

.chat-widget__panel[hidden] {
  display: none;
}

.chat-widget__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ss-space-3);
  padding: var(--ss-space-4) var(--ss-space-5);
  background: var(--ss-primary);
  color: var(--ss-white);
}

.chat-widget__title {
  font-family: var(--ss-font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.chat-widget__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
}

.chat-widget__close {
  border: none;
  background: transparent;
  color: var(--ss-white);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.chat-widget__transcript {
  flex: 1;
  overflow-y: auto;
  padding: var(--ss-space-4) var(--ss-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--ss-space-4);
  background: var(--ss-bone);
}

.chat-widget__turn {
  display: flex;
  flex-direction: column;
  gap: var(--ss-space-2);
}

.chat-widget__bubble {
  max-width: 88%;
  padding: var(--ss-space-3) var(--ss-space-4);
  border-radius: var(--ss-radius-sm);
  font-size: 0.92rem;
  line-height: 1.45;
}

.chat-widget__bubble p {
  margin: 0;
}

.chat-widget__bubble + .chat-widget__handoff {
  margin-top: var(--ss-space-2);
}

.chat-widget__bubble--user {
  align-self: flex-end;
  background: var(--ss-primary);
  color: var(--ss-white);
}

.chat-widget__bubble--bot {
  align-self: flex-start;
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  color: var(--ss-ink);
}

.chat-widget__bubble--error {
  border-color: var(--ss-danger);
  color: var(--ss-danger);
}

.chat-widget__bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.85rem 1rem;
}

.chat-widget__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ss-muted);
  animation: ssChatTypingPulse 1.2s infinite ease-in-out;
}

.chat-widget__typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-widget__typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ssChatTypingPulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-widget__typing-dot {
    animation: none;
    opacity: 0.7;
  }
}

.chat-widget__handoff {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ss-space-2);
}

.chat-widget__handoff-link {
  display: inline-flex;
  align-items: center;
  border-radius: var(--ss-radius-sm);
  background: var(--ss-primary);
  color: var(--ss-white);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  transition: background-color var(--ss-transition);
}

.chat-widget__handoff-link:hover {
  background: var(--ss-primary-dark);
}

.chat-widget__form {
  display: flex;
  gap: var(--ss-space-2);
  padding: var(--ss-space-3) var(--ss-space-4);
  border-top: 1px solid var(--ss-border);
  background: var(--ss-surface);
}

.chat-widget__form input[type="text"] {
  flex: 1;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-sm);
  padding: 0.65rem 0.9rem;
  font-family: var(--ss-font-sans);
  font-size: 0.92rem;
}

.chat-widget__form input[type="text"]:focus {
  outline: 2px solid var(--ss-primary);
  outline-offset: 1px;
}

.chat-widget__send {
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
}

.chat-widget__fallback {
  margin: 0;
  padding: var(--ss-space-2) var(--ss-space-4) var(--ss-space-3);
  font-size: 0.78rem;
  color: var(--ss-muted);
  background: var(--ss-surface);
}

.chat-widget__fallback a {
  color: var(--ss-primary);
}

@media (max-width: 480px) {
  .chat-widget {
    right: var(--ss-space-3);
    bottom: var(--ss-space-3);
    left: var(--ss-space-3);
  }

  .chat-widget__panel {
    width: 100%;
  }

  .chat-widget__toggle-label {
    display: none;
  }
}
