/* ===================================================================
   Moby — customer/tenant mobile app's own design language,
   loaded on every page via _layout.html, after common/_tokens.css
   (the single source for values shared with the admin dashboards too).
   ink/white/border/text-tertiary/font-body/teal come from there —
   this file only holds what's deliberately different here: a rounder
   radius scale, Poppins headlines, and this family's own neutral shades.
   =================================================================== */

:root {
  /* --navy aliases to --ink (Primary Navy) — see common/_shell.css for why. */
  --navy:       var(--ink);
  --mist:       #E6EEF2;
  --paper:      #F7F9FA;
  /* --green used to be kept as its own distinct vibrant shade, deliberately
     different from --success, back when there was no authoritative brand
     spec. docs/brand-palette.md defines exactly one Success green, so
     keeping two is itself an "additional brand color" — now a real alias. */
  --green:      var(--success);
  --amber:      var(--warning);

  --text-primary:   var(--ink);
  --text-secondary: #6E7B87;
  --text-on-dark:   #C9D7DE;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-display: "Poppins", system-ui, sans-serif;

  --shadow-card:        0 1px 2px color-mix(in srgb, var(--ink) 4%, transparent), 0 8px 24px color-mix(in srgb, var(--ink) 6%, transparent);
  --shadow-card-lifted: 0 4px 12px color-mix(in srgb, var(--ink) 8%, transparent), 0 16px 40px color-mix(in srgb, var(--ink) 10%, transparent);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

html, body { overflow-x: hidden; }

body {
  font-family: var(--font-body);
  background: var(--mist);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ===================================================================
   Shared form-input error state — used by both login and signup pages.
   Defined once here instead of duplicated in login.css and signup.css.
   =================================================================== */
.input-error {
  border-color: var(--danger) !important;
}

/* ===================================================================
   Outer frame
   =================================================================== */
.phone-frame {
  display: flex;
  justify-content: center;
  padding: 32px 0;
  min-height: 100vh;
  background: var(--mist);
}

.screen {
  width: 390px;
  max-width: 100%;
  background: var(--paper);
  border-radius: 36px;
  overflow: hidden;
  box-shadow: 0 30px 60px -20px color-mix(in srgb, var(--ink) 35%, transparent);
  display: flex;
  flex-direction: column;
  height: 844px;
}

@media (max-width: 480px) {
  .phone-frame { padding: 0; }
  /* 100vh is the viewport height with Safari's address bar/toolbar chrome
     collapsed — taller than what's actually visible while that chrome is
     showing. .screen has overflow:hidden (only .content scrolls inside
     it), so a .screen sized to the larger 100vh pushes the tabbar below
     the real visible fold with no page-level scroll to trigger Safari's
     chrome to collapse and reveal it. 100dvh tracks the true visible
     viewport as the chrome shows/hides instead. */
  .screen { border-radius: 0; height: 100dvh; width: 100%; }
}

/* ===================================================================
   Topbar (mobile only)
   =================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* black-translucent status bar: in the installed app the page draws
     under the clock/reception icons, so the navy bar keeps its colour up
     there but the brand row starts below the inset. */
  padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 14px;
  background: var(--ink);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 35px; color: var(--teal); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }

.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: var(--white);
}
.brand-word b { font-weight: 800; color: var(--teal); }

.brand-tagline {
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  color: var(--text-on-dark);
  margin-top: 2px;
}

.bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bell-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.bell-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  border: 1.5px solid var(--ink);
}

/* ===================================================================
   Content scroll area
   =================================================================== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===================================================================
   Flash messages
   =================================================================== */
.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  opacity: 1;
  transition: opacity 250ms, transform 250ms;
}
.flash-message--dismissing {
  opacity: 0;
  transform: translateX(12px);
}

.flash-message--success { background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--green); }
.flash-message--danger  { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.flash-message--warning { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--amber); }
.flash-message--info    { background: color-mix(in srgb, var(--teal) 10%, transparent); color: var(--teal-deep); }

.flash-close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  display: flex;
  align-items: center;
  padding: 0;
}
.flash-close:hover { opacity: 1; }

/* ===================================================================
   Shared card shell
   =================================================================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card-heading h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.card-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Single "locked" indicator, shared across every customer page (quick
   action tiles, the credits card, the report-issue property picker) —
   previously three near-duplicate one-off badges with different shapes,
   sizes, and one hardcoding uppercase text instead of using
   text-transform like the others. */
.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}
.lock-badge i { font-size: 11px; }

/* ===================================================================
   Nav links — shared between sidebar and tab bar
   =================================================================== */
.nav-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
}
.nav-link--active { color: var(--teal-deep); }

/* ===================================================================
   Tab bar (mobile only)
   =================================================================== */
.tabbar {
  flex-shrink: 0;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--mist);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
}

/* With org context the legal footer renders below the tabbar, so the
   footer — not the tabbar — borders the home indicator and absorbs the
   safe-area inset. Both here would leave a dead white band between the
   tab icons and the footer in the installed app. */
.tabbar--with-footer {
  padding-bottom: 8px;
}

.tabbar .nav-link {
  flex: 1;
  flex-direction: column;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 0;
}
.tabbar .nav-link--active { color: var(--teal-deep); }
.tabbar .nav-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

/* CTA bubble — tabbar */
.tabbar .nav-link--cta {
  color: var(--teal-deep);
  position: relative;
}
.tabbar .nav-link--cta .nav-cta-bubble {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--teal) 45%, transparent);
  margin-top: -20px;
}
.tabbar .nav-link--cta span:not(.nav-cta-bubble) {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--teal-deep);
  margin-top: 2px;
}

/* ===================================================================
   Sidebar (desktop only)
   =================================================================== */
.sidebar { display: none; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 28px; }
.brand-logo { max-height: 36px; max-width: 140px; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-brand .brand-mark { width: 28px; height: 33px; color: var(--teal); flex-shrink: 0; }
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }

.sidebar-brand .brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: var(--white);
}
.sidebar-brand .brand-word b { font-weight: 800; color: var(--teal); }

.sidebar-brand .brand-tagline {
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  color: var(--text-on-dark);
  margin-top: 2px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar-nav .nav-link {
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-on-dark);
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--white); }
.sidebar-nav .nav-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.sidebar-nav .nav-link svg { flex-shrink: 0; }

.sidebar-nav .nav-link--active { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.sidebar-nav .nav-link--active:hover { background: color-mix(in srgb, var(--teal) 20%, transparent); color: var(--teal); }

/* CTA row — sidebar */
.sidebar-nav .nav-link--cta {
  background: var(--teal);
  color: var(--white);
  border-radius: 10px;
  margin-top: 8px;
}
.sidebar-nav .nav-link--cta:hover { background: var(--teal-deep); color: var(--white); }
.sidebar-nav .nav-link--cta .nav-cta-bubble { display: none; }

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
}

.sidebar-footer .bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sidebar-footer .bell-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.sidebar-footer .bell-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  border: 1.5px solid var(--ink);
}

.logout-btn {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-on-dark);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
}

.logout-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ===================================================================
   Desktop breakpoint — sidebar replaces topbar/tabbar
   Page-specific grid-template-areas (e.g. home.css) extend .content
   inside their own @media (min-width: 768px) block — this block only
   handles the chrome shared by every page: sidebar, topbar, tabbar.
   =================================================================== */
@media (min-width: 768px) {

  .phone-frame {
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    min-height: 100vh;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 248px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--ink);
    padding: 24px 18px;
  }

  .sidebar-footer {
    justify-content: space-between;
  }

  .screen > .topbar,
  .tabbar {
    display: none;
  }

  .screen {
    flex: 1;
    width: auto;
    max-width: none;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
  }
}

/* ===================================================================
   Shared form elements — used across wizard, properties, profile, support
   =================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.form-optional {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 11px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-control {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: var(--radius-md);
  appearance: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.form-control::placeholder { color: #A9B6BE; }

.form-control:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 15%, transparent);
}

textarea.form-control {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* Primary button */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
  text-decoration: none;
}

.btn-primary:hover { background: var(--navy); }
.btn-primary:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn-primary:disabled { background: #B7C2C8; cursor: not-allowed; }

/* Compact inline variant — e.g. a header action next to a page title,
   where the full-width block button doesn't fit. */
.btn-primary--sm {
  display: inline-flex;
  width: auto;
  height: 34px;
  padding: 0 14px;
  gap: 5px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-primary:disabled:hover { background: #B7C2C8; }

/* Outline companion to .btn-primary — secondary inline actions (e.g. the
   "Enable" browser-push button on notification preferences, used by both
   the customer and tenant portals, which share this stylesheet). */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  text-decoration: none;
}
.btn-outline:hover { border-color: var(--ink); background: var(--paper); }
.btn-outline:disabled { color: #B7C2C8; border-color: var(--border); cursor: not-allowed; background: none; }

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===================================================================
   Subpage chrome — shared by properties, support, profile, etc.
   =================================================================== */
.subpage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.subpage-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.subpage-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  margin: 0;
}

.subpage-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-size: 20px;
}
.subpage-back:hover { background: var(--mist); }

/* ===================================================================
   Footer — legal and support links
   =================================================================== */
/* Bottom padding and max-height grow by the safe-area inset: the footer
   is the last element in .screen, so it clears the home indicator in the
   installed app (see .tabbar--with-footer). */
.customer-footer {
  max-height: calc(32px + env(safe-area-inset-bottom, 0px));
  padding: 4px 16px calc(4px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #E0E7EC;
  background: var(--white);
  overflow: hidden;
  transition: max-height 300ms ease, padding 300ms ease;
  position: relative;
}

.customer-footer.expanded {
  max-height: calc(400px + env(safe-area-inset-bottom, 0px));
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.footer-collapsed-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 1;
  transition: opacity 300ms ease;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  margin-bottom: 12px;
}

.footer-chevron {
  display: inline-block;
  transition: transform 300ms ease;
  font-size: 10px;
}

.customer-footer.expanded .footer-chevron {
  transform: rotate(180deg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  opacity: 0;
  transition: opacity 300ms ease 150ms;
}

.customer-footer.expanded .footer-grid {
  opacity: 1;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-section h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.footer-section a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 120ms ease;
}

.footer-section a:hover {
  color: var(--teal);
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ===================================================================
   Cookie consent banner
   =================================================================== */
.cookie-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cookie-banner-text {
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
  margin: 0;
  line-height: 1.4;
}

.cookie-banner-text a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 120ms ease;
}
.cookie-btn:hover { opacity: 0.85; }

.cookie-btn--accept {
  background: var(--teal);
  color: var(--white);
}

.cookie-btn--decline {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
}

/* Add to Home Screen banner styles moved to common/_a2hs.css — shared
   with the contractor and tenant layouts. */

/* ===================================================================
   Reduced motion
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
  .shield-fill { transition: none; }
}