/**
 * Tenant PWA styles.
 * Mirrors app design tokens (see src/theme/colors.ts).
 */
:root {
  --color-text: #333333;
  --color-text-secondary: #767676;
  --color-background: #F1F1F1;
  --color-card: #FFFFFF;
  --color-card-secondary: #E5E5E5;
  /** Light accent tint (native tertiaryBackground). Use for avatar backgrounds. */
  --color-tertiary-background: #FFECEF;
  --color-accent: #FF395C;
  --color-success: #28B03D;
  --color-warning: #FF8206;
  --color-border: rgba(118, 118, 118, 0.3);
  --max-content-width: 1000px;
  /* Native app dropShadow1 */
  --shadow-card: 0 1px 4px rgba(12, 12, 13, 0.05);
  --color-on-accent: #FFFFFF;
  --color-hover: #E8E8E8;
  --color-accent-tint: rgba(255, 57, 92, 0.05);
  --color-accent-hover: rgba(255, 57, 92, 0.08);
  --color-warning-tint: rgba(255, 130, 6, 0.05);
  --color-success-tint: rgba(40, 176, 61, 0.05);
  --color-overlay: rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 4px 24px rgba(0, 0, 0, 0.15);
  --shadow-modal-account: 0 16px 48px rgba(0, 0, 0, 0.2);
  --shadow-nav: 0 -2px 8px rgba(0, 0, 0, 0.06);
  --shadow-banner: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-switch: 0 1px 3px rgba(0, 0, 0, 0.2);
  --radius-pill: 9999px;
  --radius-card: 16px;
  --radius-modal: 12px;
  --radius-input: 8px;
  --font-size-xs: 10px;
  --font-size-sm: 11px;
  --font-size-caption: 12px;
  --font-size-body: 14px;
  --font-size-input: 16px;
  --font-size-h3: 18px;
  --font-size-h2: 20px;
  --font-size-h1: 24px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 800;
  --line-height-tight: 1.2;
  --line-height-normal: 1.4;
  --line-height-relaxed: 1.5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Hide scrollbars everywhere; scrolling still works */
*::-webkit-scrollbar {
  display: none;
}

/* Buttons – fully rounded (pill) */
button,
.header-back,
a.btn-add-task,
a.btn-add-utility,
a.btn-pay-now,
.btn-primary,
.btn-secondary,
.btn-accept-sign,
.btn-save-status,
.btn-delete-task,
.btn-attach,
.account-card-edit,
.account-card-clickable,
.account-card-secondary,
.account-signout,
.account-signout-secondary,
.account-push-btn,
.chat-send,
.invite-card .btn-accept,
.install-banner-install,
.auth-form .auth-submit {
  border-radius: var(--radius-pill);
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-background);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* Form controls and interactive elements inherit Montserrat (browsers often use system font otherwise) */
input,
button,
select,
textarea,
optgroup,
.app-content .card-title,
.app-content .collapse-head span:first-child,
.tasks-toggle,
.account-select,
.account-signout,
.account-push-btn {
  font-family: inherit;
}

#root {
  min-height: 100vh;
  max-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mobile: dynamic viewport height avoids extra scroll when 100vh > visible area (iOS Chrome/Safari) */
@media (max-width: 768px) {
  @supports (height: 100dvh) {
    #root {
      min-height: 100dvh;
      max-height: 100dvh;
      height: 100dvh;
    }
    body {
      min-height: 100dvh;
    }
  }
}

/* ── Shared component classes ─────────────────────────────── */

.icon-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: var(--color-background);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
}
.icon-btn:hover {
  background: var(--color-hover);
  color: var(--color-text);
}
.icon-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.icon-btn:disabled:hover {
  background: var(--color-background);
  color: var(--color-text-secondary);
}
.icon-btn img,
.icon-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--color-tertiary-background);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar svg {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

.flyout {
  position: absolute;
  top: 100%;
  margin-top: 4px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-modal);
  padding: 8px;
  box-shadow: var(--shadow-card);
}
.flyout[hidden] {
  display: none;
}

.flyout-option {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  color: var(--color-text);
  background: none;
  border: none;
  border-radius: var(--radius-input);
  cursor: pointer;
  text-align: left;
}
.flyout-option:hover {
  background: var(--color-card-secondary);
}

.empty-inline {
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-secondary);
}

.text-input {
  padding: 12px 14px;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  font-family: inherit;
  box-sizing: border-box;
}

.text-input-lg {
  font-size: var(--font-size-input);
}

.select-input {
  width: 100%;
  padding: 12px 14px;
  font-size: var(--font-size-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  color: var(--color-text);
  font-family: inherit;
  box-sizing: border-box;
}

.select-input-sm {
  font-size: var(--font-size-body);
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-body);
}

.btn-outline-accent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  background: transparent;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
}
.btn-outline-accent:hover {
  background: var(--color-tertiary-background);
}

.btn-ghost {
  padding: 10px 20px;
  font-size: var(--font-size-body);
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-background);
}
.btn-ghost:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── End shared component classes ────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* Header section: flex container on all viewports so .app-main gets bounded height and inner scroll works */
.app-header-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Header – full width; 16px inner padding on mobile, 24px on desktop; safe-area on top/sides */
.app-header {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 16px calc(16px + env(safe-area-inset-left));
  width: 100%;
  max-width: var(--max-content-width);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  .app-header {
    padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) 24px calc(24px + env(safe-area-inset-left));
  }
}

/* Logo: desktop only, top left; spacing to title matches back button (16px) */
.header-logo {
  display: none;
  align-items: center;
  margin-right: 16px;
  flex-shrink: 0;
}

.header-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

@media (min-width: 769px) {
  .header-logo {
    display: flex;
  }
}

.header-back {
  width: 48px;
  height: 48px;
  margin-right: 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

/* Icon size standard: all icons 24x24px except .task-status-icon (chips) at 16x16 */
.header-back svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* Mobile: hide back button on My account page (desktop only has back on account) */
@media (max-width: 768px) {
  .app-header.route-account .header-back {
    display: none !important;
  }
}

/* Desktop: back button replaces logo (same slot), secondary bg + 16px radius like account icon */
@media (min-width: 769px) {
  .app-header.header-with-back .header-logo {
    display: none;
  }
  .app-header.header-with-back .header-back {
    background: var(--color-card-secondary);
    border-radius: var(--radius-card);
  }
  .app-header.header-with-back .header-back:hover {
    opacity: 0.9;
  }
}

.header-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

/* My account icon button – top right, same row as title (desktop only; mobile uses nav tab) */
.header-account-wrap {
  display: none;
  flex-shrink: 0;
  margin-left: auto;
}

@media (min-width: 769px) {
  .header-account-wrap.header-account-visible {
    display: flex;
  }
  .header-account-wrap .header-icon-btn svg {
    width: 24px;
    height: 24px;
  }
}

.header-icon-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius-card);
  background: var(--color-card-secondary);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.header-icon-btn:hover {
  opacity: 0.9;
}

.header-icon-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* When account button is visible, header-action sits next to it */
.header-account-wrap + .header-action {
  margin-left: 8px;
}

/* Mobile: create issue/utility button in header (right); desktop: hidden, buttons stay in content */
.header-action {
  margin-left: auto;
  flex-shrink: 0;
}

.header-action .header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  text-decoration: none;
}

.header-action .header-action-btn:hover {
  opacity: 0.9;
}

@media (min-width: 769px) {
  .header-action {
    display: none;
  }
  /* Hide My account tab on desktop; account is in header icon only */
  .app-nav .nav-item[data-route="account"] {
    display: none;
  }
}

/* Mobile: pin top app bar on Tasks, Utilities, Landlord (chat) — same feel as Contract / My account */
@media (max-width: 768px) {
  .app-shell.mobile-header-fixed .app-header:not(.auth-screen) {
    position: fixed;
    top: var(--tenant-banner-top, 0px);
    left: 0;
    right: 0;
    z-index: 15;
    width: 100%;
    max-width: var(--max-content-width);
    margin-left: auto;
    margin-right: auto;
    background: var(--color-background);
  }

  .app-shell.mobile-header-fixed .app-main {
    padding-top: var(--tenant-mobile-header-offset, calc(88px + env(safe-area-inset-top, 0px)));
  }
}

@media (min-width: 769px) {
  .app-shell.mobile-header-fixed .app-header:not(.auth-screen) {
    position: static;
    top: auto;
    background: transparent;
  }

  .app-shell.mobile-header-fixed .app-main {
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  .tasks-issues .tasks-section-title-row .btn-add-task {
    display: none;
  }
  .page-utilities .utilities-actions {
    display: none;
  }
  /* Create issue/utility in header: use same reversed (outline) style as in-content add buttons */
  .header-action .header-action-btn {
    color: var(--color-accent);
    background: transparent;
    border: 1px solid var(--color-accent);
  }
  .header-action .header-action-btn:hover {
    background: var(--color-tertiary-background);
    opacity: 1;
  }
}

/* Main content – no horizontal padding so scrollbar reaches viewport edge; padding lives in .app-content-inner */
.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  /* Must equal mobile .app-nav outer height (16 + icon row + 16) */
  padding-bottom: 80px;
  overflow: hidden;
  background: var(--color-background);
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 200px;
}

.loading-text {
  color: var(--color-text-secondary);
}

/* Content area – stretches between header and bottom of viewport; no scroll here */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

/* Scroll wrapper – fills .app-content and scrolls; full width so scrollbar at viewport edge */
.app-content-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  padding-top: 8px;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}

/* Inner content constrained to max-width; grows with content so .app-content-scroll can scroll */
.app-content-inner {
  width: 100%;
  max-width: var(--max-content-width);
  margin-left: auto;
  margin-right: auto;
  display: block;
  flex-shrink: 0;
  box-sizing: border-box;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: 32px;
}

@media (max-width: 768px) {
  .app-content-inner {
    padding-bottom: 0;
  }
}

/* Chat view: scroll wrapper doesn't scroll; inner fills so .page-chat can flex and messages scroll */
.app-content.app-content--chat .app-content-scroll {
  overflow: hidden;
  padding-bottom: 16px;
}

.app-content.app-content--chat .app-content-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: 0;
}

.app-content.app-content--chat .page-chat {
  flex: 1;
  min-height: 0;
  padding: 0;
}

.route-placeholder,
.auth-placeholder,
.page-loading {
  padding: 24px 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

/* Page sections – no vertical padding; content area provides top padding */
.page-overview,
.page-chat,
.page-tasks,
.page-utilities,
.page-account {
  padding: 0;
}

/* Bottom spacing so last content doesn't touch viewport bottom (chat has its own layout) */
.page-overview,
.page-tasks,
.page-utilities,
.page-account {
  padding-bottom: 32px;
}

/* Overview – tenant card, lease, security deposit, inspections (native-style white cards, drop shadow 1) */
.overview-card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
}

.overview-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0;
}

.overview-card .card-row {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.overview-card .card-row-secondary {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-top: 6px;
  margin-bottom: 0;
}

.overview-card .overview-card-divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px -16px;
}

.overview-lease-dates {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.overview-lease-date-block {
  flex: 1;
}

.overview-lease-date-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.overview-lease-date-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.overview-tenant-row {
  display: flex;
  align-items: center;
}

.overview-tenant-avatar {
  margin-right: 12px;
}

.overview-tenant-info {
  flex: 1;
  min-width: 0;
}

.overview-collapsibles {
  margin-top: 0;
  margin-bottom: 32px;
}

.overview-collapse {
  background: var(--color-card);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.overview-collapse .collapse-head {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.overview-collapse .collapse-head:hover {
  background: none;
}

.overview-collapse .collapse-head span:first-child {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
}

.overview-collapse .collapse-arrow {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin: 0;
  display: block;
  border-right: 2px solid var(--color-text-secondary);
  border-bottom: 2px solid var(--color-text-secondary);
  transform: rotate(45deg);
  transition: transform 0.2s;
}

.overview-collapse.collapse-open .collapse-arrow {
  transform: rotate(-135deg);
}

/* Empty state: no expand/collapse, always expanded, no chevron */
.overview-collapse-empty .collapse-arrow {
  display: none;
}
.overview-collapse-empty .collapse-head {
  cursor: default;
  pointer-events: none;
}
.overview-collapse-empty .collapse-head:disabled {
  opacity: 1;
}

.overview-collapse .collapse-body {
  padding: 0;
  padding-top: 16px;
}

/* When collapsed: hide only gray cards; meta and signing stay visible */
.overview-collapse:not(.collapse-open) .collapse-body .overview-subcard {
  display: none;
}

/* When collapsed and there are gray cards (hidden), separator is added by JS to first visible meta/signing. Full width of card (through inner 16px margins). */
.overview-collapse .collapse-body .collapse-separator {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  padding-left: 16px;
  padding-right: 16px;
  margin-top: 0;
  margin-left: -16px;
  margin-right: -16px;
}

.overview-subcard {
  padding: 16px;
  margin-top: 16px;
  background: var(--color-background);
  border-radius: var(--radius-card);
  color: var(--color-text);
}

.overview-subcard:first-child {
  margin-top: 0;
}

/* Divider inside gray card (matches landlord secondaryCardDivider) */
.overview-subcard-divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px -16px;
}

/* Lease: two-column row for start/expiry (matches landlord leaseInfoRow) */
.overview-lease-info-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
}
.overview-lease-info-block {
  flex: 1;
  min-width: 0;
}
.overview-lease-info-row .overview-subcard-value {
  margin-bottom: 0;
}

/* Security deposit: large amount (matches landlord securityDepositAmount) */
.overview-deposit-amount {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-text);
}
.overview-deposit-transferred {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* Document row and link (matches landlord documentRow, documentName) */
.overview-document-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.overview-document-row:last-child {
  margin-bottom: 0;
}
.overview-document-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.overview-document-link:hover {
  text-decoration: underline;
}

/* Inspection room (matches landlord inspectionRoomCard, roomTitle) */
.overview-room-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.overview-room-notes {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0;
}
.overview-room-docs {
  margin-top: 16px;
}

/* Inspection room cards: 8px between rooms, 0 after last (matches landlord inspectionRoomCard) */
.overview-subcard-inspection-room {
  margin-top: 8px;
}
.overview-subcard-inspection-room:first-child {
  margin-top: 0;
}
.overview-subcard-inspection-room:last-of-type {
  margin-bottom: 0;
}
.overview-subcard-inspection-room .inspection-room {
  padding-top: 0;
  padding-bottom: 0;
}
.overview-subcard-inspection-room .inspection-room > *:first-child {
  margin-top: 0;
}
.overview-subcard-inspection-room .inspection-room > *:last-child {
  margin-bottom: 0;
}

.overview-signing {
  margin-top: 16px;
  margin-bottom: 0;
}

/* Empty signing block (e.g. when already signed) must not add extra space below meta */
.overview-signing:empty {
  margin-top: 0;
  display: none;
}

.overview-subcard p {
  margin-bottom: 8px;
}

.overview-subcard .overview-subcard-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.overview-subcard .overview-subcard-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}
.overview-subcard .overview-lease-info-row .overview-subcard-value {
  margin-bottom: 0;
}

.overview-subcard-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.overview-subcard-meta-created,
.overview-subcard-meta-signed {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .overview-subcard-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

.doc-link {
  color: var(--color-accent);
  text-decoration: none;
}

.doc-link:hover {
  text-decoration: underline;
}

.signed-line,
.entry-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.btn-accept-sign {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  cursor: pointer;
}

.btn-accept-sign .btn-accept-sign-icon {
  flex-shrink: 0;
}

.btn-accept-sign:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-accept-sign:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.inspection-room {
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}

.inspection-room:first-child {
  border-top: none;
}

.room-notes {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.overview-section {
  margin-bottom: 24px;
}

.overview-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
}

.list-events,
.list-tasks {
  list-style: none;
}

.list-item,
.task-item {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 0;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.task-item-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 16px;
  color: inherit;
  text-decoration: none;
  min-height: 0;
}

.task-item-icon {
  width: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.task-item-icon svg {
  width: 24px;
  height: 24px;
  color: var(--color-text);
}

.task-item-content {
  flex: 1;
  min-width: 0;
}

.task-item-link .task-status {
  flex-shrink: 0;
  margin-left: 8px;
}

.list-meta {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.overview-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.overview-link {
  display: block;
  padding: 14px 16px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.overview-link:hover {
  background: var(--color-accent-hover);
}

/* Chat – header and input fixed, only messages scroll; vertical spacing from .app-content */
.page-chat {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-card {
  background: var(--color-card);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.chat-card-header {
  flex-shrink: 0;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

/* chat-card-avatar uses .avatar */

.chat-card-landlord-wrap {
  min-width: 0;
  flex: 1;
}

.chat-card-landlord-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.chat-card-landlord-email {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-modal);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.chat-msg-in {
  align-self: flex-start;
  background: var(--color-background);
  color: var(--color-text);
}

.chat-msg-out {
  align-self: flex-end;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.chat-msg-time {
  display: block;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 4px;
}

.chat-form {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-card);
}

/* 8px between plus (attach) and message field; gap 16 remains before send */
.chat-form .chat-attach {
  margin-inline-end: -8px;
}

.chat-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* 16px min avoids iOS Chrome/Safari auto-zoom on focus */
.chat-input {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-input);
}

.chat-send {
  flex-shrink: 0;
  cursor: pointer;
}
.chat-send.chat-send-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-send.chat-send-icon:hover:not(:disabled) {
  opacity: 0.85;
}
.chat-send.chat-send-icon img {
  width: 24px;
  height: 24px;
  display: block;
}

.chat-msg-attachment {
  display: block;
  margin-top: 4px;
}
.chat-msg-attachment-image {
  display: block;
  max-width: 240px;
  max-height: 200px;
  border-radius: var(--radius-input);
  overflow: hidden;
}
.chat-msg-attachment-image img {
  display: block;
  max-width: 100%;
  max-height: 200px;
  object-fit: cover;
  vertical-align: top;
}
.chat-msg-attachment-file {
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  color: inherit;
}

/* Tasks – native app taskCard + StatusChip */
.task-item-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.task-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-top: 8px;
  width: 100%;
}

.task-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: var(--radius-input);
  border-width: 1px;
  border-style: solid;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Exception: status chips (open/in progress/resolved/paid) keep 16x16 icons */
.task-status-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.task-status-open {
  border-color: var(--color-accent);
  background: var(--color-accent-tint);
  color: var(--color-accent);
}

.task-status-in_progress {
  border-color: var(--color-warning);
  background: var(--color-warning-tint);
  color: var(--color-warning);
}

.task-status-resolved {
  border-color: var(--color-success);
  background: var(--color-success-tint);
  color: var(--color-success);
}

/* Tasks – section title row + segmented tabs (CompactSegmentedTabs) */
.tasks-section-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-text);
  flex: 1;
}

.tasks-issues {
  margin-bottom: 24px;
}

.tasks-issues .tasks-section-title-row,
.tasks-reminders .tasks-section-title-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.tasks-issues-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.tasks-reminders {
  margin-bottom: 32px;
}

.tasks-toggles {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 4px;
  min-height: 48px;
  background: var(--color-card-secondary);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  position: relative;
}

.tasks-toggle {
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.tasks-toggle:hover {
  color: var(--color-text);
}

.tasks-toggle.active {
  color: var(--color-accent);
}

.tasks-toggles .tasks-toggle.active {
  color: var(--color-accent);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.tasks-tab-panel {
  min-height: 40px;
}

.tasks-empty-state,
.reminders-empty-inline {
  padding: 48px 16px;
  text-align: center;
}

/* tasks-empty-text / tasks-empty-subtext consolidated into .empty-inline */

.list-tasks .empty-inline,
.list-reminders .empty-inline {
  padding: 16px;
  text-align: center;
}

.tasks-reminders .tasks-section-title-row {
  margin-bottom: 16px;
}

/* Reminders grouped by month+year */
.reminders-group {
  margin-top: 20px;
}
.reminders-group:first-child {
  margin-top: 0;
}
.reminders-group-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.list-reminders {
  list-style: none;
}

.reminder-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.reminder-item-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  padding: 0;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.reminder-item:not(:has(.reminder-item-link)) {
  padding: 16px;
}

.reminder-item > .reminder-label { flex: 1; }

.reminder-item-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reminder-item-icon .reminder-icon-img {
  width: 24px;
  height: 24px;
  display: block;
}

.reminder-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.reminder-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.reminder-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.reminder-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.reminder-paid {
  flex-shrink: 0;
  margin-left: auto;
}

.reminder-pay {
  flex-shrink: 0;
  margin-left: 8px;
}

/* Pay now button on the right of rent reminder cards – same size/margins as add issue/reminder */
.reminder-pay-right {
  flex-shrink: 0;
  margin-left: auto;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
}

.reminder-meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

.reminder-meta.reminder-amount {
  font-weight: 600;
  color: var(--color-text);
}

.reminder-item-link > .reminder-label,
.reminder-item-link > .reminder-item-content { flex: 1; min-width: 0; }
.reminder-item-link > .reminder-paid,
.reminder-item-link > .reminder-pay,
.reminder-item-link > .reminder-meta {
  margin-left: auto;
  margin-top: 0;
}

.task-item-link:hover,
.reminder-item-link:hover {
  color: inherit;
}

.tasks-actions,
.utilities-actions {
  margin-bottom: 16px;
}

/* btn-add-task, btn-add-utility use .btn-outline-accent */

.btn-add-task .btn-add-icon,
.btn-add-utility .btn-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-add-task .btn-add-icon svg,
.btn-add-utility .btn-add-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.btn-pay-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 18px;
  min-width: 90px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  text-decoration: none;
  position: relative;
}

.btn-pay-now:hover {
  opacity: 0.9;
}

.btn-pay-now.btn-loading {
  color: transparent;
  pointer-events: none;
}

.btn-pay-now.btn-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-on-accent);
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Utilities – native app utilityCard + utilityMonthGroup */
.utility-month-group {
  margin-bottom: 16px;
}

.utility-month-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.utility-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.utility-card:hover {
  opacity: 0.95;
}

.utility-card-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.utility-card-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.utility-card-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.utility-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.utility-card-subheader {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.utility-card-right {
  flex-shrink: 0;
  text-align: right;
  margin-left: 12px;
}

.utility-card-reading {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.utilities-empty-state {
  padding: 48px 0;
  text-align: center;
}

/* utilities-empty-text consolidated into .empty-inline */

/* Detail & form pages – overlay content: read-only not in card; only files and comments in cards */
.page-detail {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-top: 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.detail-card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 16px 20px 20px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Overlay: no drop shadow on any section (detail + create) */
#detail-modal .detail-card,
#detail-modal .detail-file-card,
#detail-modal .detail-interested-item,
#detail-modal .detail-status-selector,
#detail-modal .detail-status-picker-flyout,
#detail-modal .detail-comment-card,
#detail-modal .detail-comment-menu-flyout {
  box-shadow: none;
}

.detail-card + .overlay-actions-wrap {
  margin-top: 0;
}

.detail-card:has(+ .overlay-actions-wrap) {
  margin-bottom: 0;
}

/* Read-only block (no card wrapper) */
.detail-content {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
  margin-top: 0;
}

.detail-files-list,
.detail-interested-list {
  list-style: none;
  margin: 0 0 24px 0;
  padding: 0;
}

.detail-file-thumb {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-input);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-file-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-file-thumb-placeholder-only .detail-file-thumb-fallback {
  display: flex;
}

.detail-file-thumb-fallback {
  position: absolute;
  inset: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-input);
  background: var(--color-card-secondary);
  align-items: center;
  justify-content: center;
  display: none;
}

.detail-file-thumb-fallback img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.detail-file-card {
  background: var(--color-background);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-file-card:last-child {
  margin-bottom: 0;
}

.detail-interested-item {
  background: var(--color-background);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-interested-item:last-child {
  margin-bottom: 0;
}

.detail-file-info,
.detail-interested-item > div {
  flex: 1;
  min-width: 0;
}

.detail-file-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.detail-file-link {
  color: var(--color-text);
  text-decoration: none;
}

.detail-file-link:hover {
  text-decoration: underline;
  color: var(--color-accent);
}

.detail-file-meta {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* New issue overlay – Files section (attach + list) */
.detail-files-new-task {
  margin-top: 24px;
}

.detail-files-new-task .detail-section-title {
  margin-bottom: 8px;
}

.new-task-files-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.new-task-attach {
  flex-shrink: 0;
}

.new-task-files-hint {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.new-task-files-list {
  list-style: none;
  margin: 12px 0 0 0;
  padding: 0;
}

.new-task-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-text);
}

.new-task-file-item:last-child {
  border-bottom: none;
}

.new-task-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-task-file-remove {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-input);
}

.new-task-file-remove:hover {
  color: var(--color-accent);
  background: var(--color-tertiary-background);
}

.detail-interested-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.detail-interested-role {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.detail-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 16px;
  color: var(--color-text);
}

/* Task/event detail typography – match native landlord app (label 14px 500 secondary, value 14px 600 text) */
.detail-meta {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.detail-meta .detail-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-right: 0;
  margin-bottom: 4px;
}

.detail-meta .detail-value {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.detail-meta-created {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-top: 16px;
  margin-bottom: 24px;
}

/* Rent overlay: one row = (label+value) | Pay now / Paid */
.detail-meta-rent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.detail-rent-label-value {
  flex: 1;
  min-width: 0;
}

.detail-meta-rent-row .detail-rent-label-value .detail-label {
  display: block;
  margin-bottom: 4px;
}

.detail-meta-rent-row .detail-rent-label-value .detail-value {
  display: block;
}

.detail-meta-rent-row .detail-rent-action {
  flex-shrink: 0;
}

.detail-label {
  color: var(--color-text-secondary);
  margin-right: 6px;
}

.detail-block {
  margin-top: 24px;
}

.detail-block > .detail-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  margin-right: 0;
}

.detail-block p {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--color-text);
}

.detail-actions {
  margin-top: 16px;
}

/* Status selector – same as native landlord app: single dropdown with status inside */
.detail-status-section {
  margin-bottom: 16px;
}

.detail-status-section .detail-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.detail-status-selector {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-card);
}

.detail-status-selector:hover {
  border-color: var(--color-text-secondary);
}

.detail-status-selector-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-status-selector-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.detail-status-selector-text {
  flex: 1;
  min-width: 0;
}

.detail-status-selector[data-current-status="open"] .detail-status-selector-icon,
.detail-status-selector[data-current-status="open"] .detail-status-selector-text {
  color: var(--color-accent);
}

.detail-status-selector[data-current-status="in_progress"] .detail-status-selector-icon,
.detail-status-selector[data-current-status="in_progress"] .detail-status-selector-text {
  color: var(--color-warning);
}

.detail-status-selector[data-current-status="resolved"] .detail-status-selector-icon,
.detail-status-selector[data-current-status="resolved"] .detail-status-selector-text {
  color: var(--color-success);
}

.detail-status-selector-chevron {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.detail-status-selector-chevron svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* Status picker – dropdown flyout below the selector */
.detail-status-dropdown-wrap {
  position: relative;
}

.detail-status-picker-flyout {
  left: 0;
  right: 0;
  z-index: 100;
  min-width: 100%;
}

.detail-status-picker-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* detail-status-picker-option uses .flyout-option */

.detail-status-picker-option-selected {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.detail-status-picker-option-selected:hover {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

/* btn-delete-task uses .btn-ghost */

.detail-subtitle {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
}

.detail-comments {
  margin-top: 0;
  margin-bottom: 0;
}

.detail-comments .detail-section-title {
  margin-bottom: 8px;
}

.detail-comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-comment-item {
  margin-bottom: 8px;
}

.detail-comment-item:last-child {
  margin-bottom: 0;
}

.detail-comment-card {
  background: var(--color-background);
  border-radius: var(--radius-card);
  padding: 16px;
}

.detail-comment-card-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.detail-comment-body-wrap {
  flex: 1;
  min-width: 0;
}

.detail-comment-menu-wrap {
  flex-shrink: 0;
  position: relative;
  align-self: flex-start;
}

.detail-comment-menu-btn {
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.detail-comment-menu-btn:hover {
  background: transparent;
  color: var(--color-text-secondary);
}

.detail-comment-menu-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.detail-comment-menu-flyout {
  right: 0;
  z-index: 50;
  min-width: 120px;
}

.detail-comment-delete {
  color: var(--color-accent);
}

.detail-comment-delete:hover {
  background: var(--color-tertiary-background);
}

.detail-comment-body {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.detail-comment-content {
  display: block;
}

.detail-comment-meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  display: block;
  margin-top: 4px;
  margin-bottom: 0;
}

.detail-comment-body .task-attachment-link {
  display: inline-block;
  margin-top: 4px;
}

/* Sticky comment form at bottom of overlay – same layout as Landlord chat (plus + input + Send icon) */
.detail-comment-form-wrap {
  flex-shrink: 0;
  padding: 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
}

.detail-comment-form-wrap.uploading {
  opacity: 0.7;
  pointer-events: none;
}

.detail-comment-form-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* detail-comment-attach uses .icon-btn */

/* Match .chat-input — 16px avoids iOS Safari/Chrome auto-zoom on focus (14px from .text-input alone does not). */
.detail-comment-input {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-input);
}

.detail-comment-send {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-comment-send:hover:not(:disabled) {
  opacity: 0.85;
}
.detail-comment-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.detail-comment-send img {
  width: 24px;
  height: 24px;
  display: block;
}

.task-attachments-list {
  list-style: none;
  margin-bottom: 16px;
}

.task-attachment-item {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.task-attachment-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 14px;
}

.task-attachment-link:hover {
  text-decoration: underline;
}

.task-attachment-thumb-wrap {
  display: inline-block;
  position: relative;
  max-width: 80px;
  max-height: 80px;
  border-radius: var(--radius-input);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.task-attachment-thumb {
  display: block;
  max-width: 80px;
  max-height: 80px;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-input);
}

.task-attachment-thumb-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 80px;
  min-height: 80px;
  background: var(--color-card-secondary);
  align-items: center;
  justify-content: center;
  display: none;
  border-radius: var(--radius-input);
}

.task-attachment-thumb-fallback img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.task-attach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.task-attach-actions.uploading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-attach {
  font-weight: 500;
  background: var(--color-card);
}

/* Detail modal overlay – fullscreen on mobile, centered dialog on desktop */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--color-overlay);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.modal-box {
  background: var(--color-card);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100vh;
  box-shadow: var(--shadow-modal);
  position: relative;
  padding: 0;
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-text);
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* modal-header-edit, modal-header-delete use .icon-btn */

.modal-header-menu-wrap {
  position: relative;
}

/* modal-header-menu-btn uses .icon-btn */

.modal-header-menu-flyout {
  right: 0;
  z-index: 50;
  min-width: 120px;
}

.modal-header-menu-option:hover {
  background: var(--color-background);
}

.modal-header-menu-option-delete {
  color: var(--color-accent);
}

/* modal-close uses .icon-btn */

.modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* Flex child forms otherwise grow to date input intrinsic width (iOS) and overflow */
.modal-body > form {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Reserve height while overlay content is loading to avoid stepwise height growth */
.modal-body:has(.page-loading) {
  min-height: 50vh;
}

/* Desktop: modal as centered dialog, not fullscreen */
@media (min-width: 769px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }

  .modal-box {
    width: 100%;
    max-width: 600px;
    height: auto;
    max-height: 90vh;
    border-radius: var(--radius-modal);
  }

  .modal-header {
    border-radius: var(--radius-modal) var(--radius-modal) 0 0;
  }

  .modal-body {
    border-radius: 0 0 var(--radius-modal) var(--radius-modal);
  }
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  margin-top: 12px;
  color: var(--color-text);
}

.form-label:first-of-type {
  margin-top: 0;
}

.form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  color: var(--color-text);
  box-sizing: border-box;
}

/* WebKit/iOS: date/datetime controls use a wide intrinsic min-width and ignore normal width */
.form-input[type="date"],
.form-input[type="datetime-local"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  field-sizing: fixed;
}

.form-input[type="date"]::-webkit-datetime-edit,
.form-input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  max-width: 100%;
  padding: 0;
}

/* iOS Safari: native date input ignores width; shell clips so border matches other fields */
.form-date-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
}

.form-date-wrap .form-input--date,
.form-date-wrap input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  field-sizing: fixed;
}

.form-date-wrap input[type="date"]::-webkit-datetime-edit {
  min-width: 0;
  max-width: 100%;
  padding: 0 4px 0 0;
}

.form-date-wrap input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  max-width: 100%;
}

.form-date-wrap:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(255, 57, 92, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  margin-top: 20px;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
  margin-right: 12px;
}

/* Create/add overlay: button section container – 16px inner margins, no shadow; buttons sit 16px from bottom */
.overlay-actions-wrap {
  padding: 16px;
  box-shadow: none;
  margin: 0;
}

.overlay-actions-wrap .form-actions {
  margin-top: 0;
  margin-bottom: 0;
}

.overlay-actions-wrap .form-actions .btn-primary,
.overlay-actions-wrap .form-actions .btn-secondary {
  margin-right: 8px;
}

.overlay-actions-wrap .form-actions .btn-secondary:last-child {
  margin-right: 0;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Account – native-style white cards, edit button, language, change password, notification settings */
.page-account {
  width: 100%;
}

.account-card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
}

/* Name & Language: label + value on left, action (Edit / arrow) vertically centered to card */
.account-card-with-action {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.account-card-content {
  flex: 1;
  min-width: 0;
}

.account-card-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.account-card-value {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.account-card-value-secondary {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.account-card-action-btn {
  flex-shrink: 0;
  align-self: center;
}

.account-card-edit {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  padding: 8px;
}

.account-card-edit:hover {
  color: var(--color-accent);
}

.account-card-edit svg,
.account-card-edit .account-card-edit-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.account-card-clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
  border: none;
  font-family: inherit;
}

.account-card-clickable:hover {
  opacity: 0.95;
}

.account-card-arrow {
  font-size: 20px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Change password: secondary button – pill, secondary bg, no border, no shadow (match landlord app) */
.account-card.account-card-secondary {
  border-radius: var(--radius-pill);
  box-shadow: none;
  text-align: center;
}

.account-card-secondary {
  display: block;
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-card-secondary);
  border: none;
  cursor: pointer;
  margin-bottom: 8px;
}

.account-card-secondary:hover {
  opacity: 0.9;
}

.account-section {
  margin-bottom: 24px;
}

.account-section-profile {
  margin-top: 24px;
}

.account-section-profile:first-child {
  margin-top: 0;
}

.account-section-notifications {
  margin-top: 24px;
}

.account-notif-subsection {
  margin-bottom: 20px;
}

.account-notif-subsection:last-child {
  margin-bottom: 0;
}

.account-notif-subsection .account-notif-row:last-child {
  margin-bottom: 0;
}

.account-notif-subheading {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 0 0 12px 0;
  line-height: 1.3;
}

/* On My account page: hide property tabs (Tasks, Utilities, Landlord, Contract); only Account tab visible */
.app-nav.nav-on-account .nav-item[data-route="tasks"],
.app-nav.nav-on-account .nav-item[data-route="utilities"],
.app-nav.nav-on-account .nav-item[data-route="chat"],
.app-nav.nav-on-account .nav-item[data-route="overview"] {
  display: none;
}

/* Desktop on My account: remove nav bar entirely (no empty space, no separator line) */
@media (min-width: 769px) {
  .app-header-section:has(.app-header.route-account) .app-nav {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-bottom: none !important;
    overflow: hidden !important;
    box-shadow: none !important;
  }
}

.account-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--color-text);
}

/* account-select uses .select-input */

.account-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

.account-notif-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.account-notif-row:last-child {
  margin-bottom: 0;
}

.account-notif-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.account-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.account-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.account-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-card-secondary);
  border-radius: var(--radius-pill);
  transition: 0.2s;
}

.account-switch-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--color-card);
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: var(--shadow-switch);
}

.account-switch input:checked + .account-switch-slider {
  background: var(--color-accent);
}

.account-switch input:checked + .account-switch-slider::before {
  transform: translateX(18px);
}

.account-notif-select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  color: var(--color-text);
  min-width: 140px;
}

/* Sign out: secondary button – pill, secondary bg, no border, no shadow (match landlord app) */
.account-signout {
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  cursor: pointer;
}

.account-signout-secondary {
  display: block;
  width: 100%;
  margin-top: 24px;
  background: var(--color-card-secondary);
  border: none;
  box-shadow: none;
}

.account-signout-secondary:hover {
  opacity: 0.9;
}

/* Account modals – same chrome as detail modal (.modal-box / .modal-header / .modal-body); scoped so dialog stays centered */
.account-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--color-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.account-modal-overlay .modal-box {
  width: 100%;
  max-width: min(520px, 100%);
  height: auto;
  max-height: min(90vh, 880px);
  background: var(--color-card);
  border-radius: var(--radius-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal-account);
  padding: 0;
  position: relative;
}

.account-modal-overlay .modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-modal) var(--radius-modal) 0 0;
}

.account-modal-overlay .modal-title {
  font-size: var(--font-size-h1);
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-text);
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-modal-overlay .modal-header-actions:empty {
  display: none;
}

.account-modal-overlay .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  display: block;
}

@media (min-width: 769px) {
  .account-modal-overlay .modal-box {
    max-width: min(560px, 100%);
  }

  .account-modal-overlay .modal-body {
    border-radius: 0 0 var(--radius-modal) var(--radius-modal);
  }
}

.account-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.account-form-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  margin-bottom: 16px;
  box-sizing: border-box;
}

.account-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.account-modal-actions .btn-primary,
.account-modal-actions .btn-secondary {
  flex: 1;
}

.account-language-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-language-option {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-background);
  border: none;
  border-radius: var(--radius-card);
  cursor: pointer;
  text-align: left;
}

.account-language-option:hover {
  background: var(--color-card-secondary);
}

.account-language-option-selected {
  background: var(--color-tertiary-background);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
}

.account-profile-row {
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 6px;
}

.account-profile-label {
  color: var(--color-text-secondary);
  margin-right: 6px;
}

.account-push-section .account-heading {
  margin-top: 4px;
}

.account-push-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.account-push-status {
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 12px;
}

.account-push-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  cursor: pointer;
}

.account-push-btn:hover {
  opacity: 0.9;
}

/* Install banner – shown after login when PWA is installable */
.install-banner {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-banner);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.install-banner-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  line-height: 1.4;
}

.install-banner-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .install-banner-text {
    flex: 1 1 100%;
  }
  .install-banner-actions {
    margin-left: auto;
  }
}

.install-banner-dismiss {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
}

.install-banner-dismiss:hover {
  color: var(--color-text);
}

.install-banner-install {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  cursor: pointer;
}

.install-banner-install:hover {
  opacity: 0.9;
}

/* Install: step-by-step (iOS has no programmatic Add to Home Screen API) */
.install-howto-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.install-howto-box {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-modal-account);
}

.install-howto-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 16px 0;
  color: var(--color-text);
  line-height: 1.3;
}

.install-howto-steps {
  margin: 0 0 20px 0;
  padding-left: 20px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text);
}

.install-howto-steps li {
  margin-bottom: 10px;
}

.install-howto-steps li:last-child {
  margin-bottom: 0;
}

.install-howto-close {
  width: 100%;
}

/* Auth screens: header shows logo only; on reset-password show back icon button (same as My account) */
.app-header.auth-screen .header-title {
  display: none;
}
.app-header.auth-screen .header-logo {
  display: flex;
}
.app-header.auth-screen.header-with-back .header-logo {
  display: none;
}

/* Auth forms – content max 370px, centered vertically and horizontally */
.auth-screen-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

.auth-form {
  max-width: 370px;
  width: 100%;
  margin: 0;
  padding: 24px 0;
}

.auth-form .auth-page-title {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 24px;
  width: 240px;
  color: var(--color-text);
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-card);
  color: var(--color-text);
}

.auth-form input::placeholder {
  color: var(--color-text-secondary);
}

.auth-form .password-input-row {
  position: relative;
  margin-bottom: 0;
}

.auth-form .password-input-row .password-input-with-toggle {
  padding-right: 48px;
  margin-bottom: 0;
}

.auth-form .password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 8px;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-form .password-toggle-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.auth-form .password-strength-block {
  margin-top: 8px;
  margin-bottom: 4px;
}

.auth-form .password-strength-segments {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.auth-form .password-strength-seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--color-card-secondary);
}

.auth-form .password-strength-seg.active {
  background: var(--color-border);
}

.auth-form .password-strength-block[data-strength="weak"] .password-strength-seg.active {
  background: var(--color-accent);
}

.auth-form .password-strength-block[data-strength="medium"] .password-strength-seg.active {
  background: #ff8206;
}

.auth-form .password-strength-block[data-strength="good"] .password-strength-seg.active {
  background: #c4a000;
}

.auth-form .password-strength-block[data-strength="strong"] .password-strength-seg.active {
  background: #28b03d;
}

.auth-form .password-strength-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.auth-form .password-strength-block[data-strength="weak"] .password-strength-label {
  color: var(--color-accent);
}

.auth-form .password-strength-block[data-strength="medium"] .password-strength-label {
  color: #ff8206;
}

.auth-form .password-strength-block[data-strength="good"] .password-strength-label {
  color: #c4a000;
}

.auth-form .password-strength-block[data-strength="strong"] .password-strength-label {
  color: #28b03d;
}

.account-modal-overlay .modal-body .account-modal-password-row {
  position: relative;
  margin-bottom: 16px;
}

.account-modal-overlay .modal-body .account-modal-password-row .account-form-input {
  margin-bottom: 0;
  padding-right: 48px;
}

.account-modal-overlay .modal-body .account-modal-password-row .password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 8px;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-modal-overlay .modal-body .account-modal-strength {
  margin-top: -8px;
  margin-bottom: 16px;
}

.account-modal-overlay .modal-body .password-strength-segments {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.account-modal-overlay .modal-body .password-strength-seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--color-card-secondary);
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="weak"] .password-strength-seg.active {
  background: var(--color-accent);
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="medium"] .password-strength-seg.active {
  background: #ff8206;
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="good"] .password-strength-seg.active {
  background: #c4a000;
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="strong"] .password-strength-seg.active {
  background: #28b03d;
}

.account-modal-overlay .modal-body .password-strength-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="weak"] .password-strength-label {
  color: var(--color-accent);
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="medium"] .password-strength-label {
  color: #ff8206;
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="good"] .password-strength-label {
  color: #c4a000;
}

.account-modal-overlay .modal-body .password-strength-block[data-strength="strong"] .password-strength-label {
  color: #28b03d;
}

.auth-form .auth-link-wrap {
  margin: 12px 0 24px;
}

.auth-form .auth-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 14px;
}

.auth-form .auth-link:hover {
  text-decoration: underline;
}

.auth-form .auth-submit {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  cursor: pointer;
  margin-bottom: 24px;
}

.auth-form .auth-submit:hover:not(:disabled) {
  opacity: 0.9;
}

.auth-form .auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-form .auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.auth-form .auth-switch a {
  color: var(--color-accent);
  text-decoration: none;
  margin-left: 4px;
}

.auth-form .auth-switch a:hover {
  text-decoration: underline;
}

.auth-form .auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.auth-form .auth-back:hover {
  color: var(--color-accent);
}

/* Invites screen */
.invites-list {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 24px 0;
}

.invites-intro {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text);
  margin: 0 0 8px 0;
}

.invite-card {
  background: var(--color-card);
  border: none;
  border-radius: var(--radius-modal);
  padding: 24px 16px;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: var(--shadow-card);
}

.invite-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 100%;
}

.invite-card-illustration {
  width: 110px;
  height: 56px;
  display: block;
  margin-bottom: 16px;
}

.invite-card-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text);
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.invite-card-invited {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text);
  margin: 0 0 16px 0;
}

.invite-card .btn-accept {
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: none;
  cursor: pointer;
}

.invite-card .btn-accept:hover {
  opacity: 0.9;
}

.invite-card .btn-accept:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Empty state */
.empty-state {
  max-width: 400px;
  margin: 0 auto;
  padding: 48px 24px;
  text-align: center;
}

.empty-state h2 {
  font-size: 12px;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
}

.empty-state p {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.auth-hint {
  margin-top: 16px;
  font-size: 14px;
}

.config-message {
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.config-message code {
  font-size: 14px;
  background: var(--color-card);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Bottom nav: 16px inner margin on all sides; no extra bottom inset beyond that */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  height: auto;
  padding: 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  box-sizing: border-box;
  background: var(--color-card);
  box-shadow: var(--shadow-nav);
  z-index: 10;
}

.app-nav-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding: 0;
  box-sizing: border-box;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 48px;
  max-height: 48px;
  padding: 0;
  color: var(--color-text);
  text-decoration: none;
  font-size: 10px;
  border-radius: var(--radius-card);
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover,
.nav-item:focus {
  color: var(--color-accent);
}

/* Mobile: selected tab = accent background, white icon */
.nav-item[aria-current="page"] {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 600;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
}

/* Mobile: icon only */
.nav-label {
  display: none;
  margin-top: 4px;
}

/* Desktop: nav at top, below header, before content */
@media (min-width: 769px) {
  .app-shell {
    display: flex;
    flex-direction: column;
  }

  /* Header area container: white background from top until end of tabs */
  .app-header-section {
    order: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-card);
  }

  .app-header {
    order: 1;
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    background: transparent;
  }

  .app-nav {
    order: 2;
    position: static;
    margin-top: 16px;
    height: 56px;
    width: 100%;
    padding: 0;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Fill full nav height (mobile uses flex:0 0 auto on inner — desktop must stretch) */
  .app-nav-inner {
    width: 100%;
    max-width: var(--max-content-width);
    margin-left: auto;
    margin-right: auto;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    padding: 0 calc(24px + env(safe-area-inset-right));
    padding-left: calc(24px + env(safe-area-inset-left));
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: none;
    align-self: stretch;
  }

  /* Desktop: selected tab = accent text + 4px inset bottom border */
  .nav-item[aria-current="page"] {
    background: transparent;
    color: var(--color-accent);
    box-shadow: inset 0 -4px 0 var(--color-accent);
  }

  /* Border on main (not section): section wraps header+nav+main so its bottom is at viewport bottom; top border on main draws the line between nav and content */
  .app-main {
    order: 3;
    margin-top: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--color-border);
  }

  .app-content-inner {
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
  }

  .app-content-scroll {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .app-content.app-content--chat .app-content-scroll {
    padding-bottom: 24px;
  }

  .page-overview,
  .page-chat,
  .page-tasks,
  .page-utilities,
  .page-account {
    padding: 0;
  }

  .page-overview,
  .page-tasks,
  .page-utilities,
  .page-account {
    padding-bottom: 32px;
  }

  .nav-item {
    flex: 1;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    font-size: 14px;
    border-radius: 0;
    min-height: 0;
    max-height: none;
    align-self: stretch;
    text-align: center;
  }

  .nav-label {
    display: inline;
    margin-top: 0;
    margin-left: 4px;
  }
}

/* Interactive states */
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:active:not(:disabled) { opacity: 0.8; transform: scale(0.98); }
.btn-secondary:active:not(:disabled) { opacity: 0.8; }
.account-signout:hover:not(:disabled) { opacity: 0.9; }

.btn-primary:disabled,
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-form input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(255, 57, 92, 0.2);
}

.text-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(255, 57, 92, 0.2);
}

/* Focus-visible styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* A3: Show scrollbars on desktop for accessibility */
@media (min-width: 769px) {
  * {
    scrollbar-width: thin;
  }
  *::-webkit-scrollbar {
    display: block;
    width: 6px;
  }
  *::-webkit-scrollbar-thumb {
    background: var(--color-card-secondary);
    border-radius: 3px;
  }
}
