/* ============================================================
   Perfect HOA — Shared Design Primitives
   Restyles Bootstrap's generic component classes (modal shell,
   buttons, form controls, page card wrapper, tabs, tables,
   badges) so every screen/modal that uses them — not just ones
   we've rebuilt with custom markup — picks up the new look.
   This is the highest-leverage layer: dozens of modals and every
   unconverted screen route through these same Bootstrap classes.
   ============================================================ */

/* ============================================================
   MODAL SHELL
   ============================================================ */

.modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 24px 60px -16px rgba(20, 30, 70, 0.35);
  overflow: hidden;
}

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--phoa-subtle-5);
  align-items: flex-start;
}

.modal-header .modal-title,
.modal-title {
  font-size: 19px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  letter-spacing: -0.01em;
}

.modal-header .btn-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--phoa-subtle-4);
  background-size: 13px;
  opacity: 1;
  transition: background-color 0.12s ease;
}

.modal-header .btn-close:hover {
  background-color: var(--phoa-primary-tint);
}

.modal-body {
  padding: 24px 26px;
}

.modal-body .card-head {
  margin-bottom: 20px;
}

.modal-body .card-head .card-title {
  font-size: 19px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  margin-bottom: 2px;
}

.modal-body .card-head p {
  font-size: 13px;
  color: var(--phoa-muted-3);
  margin: 0;
}

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--phoa-subtle-5);
  gap: 10px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  border-radius: var(--phoa-r-button);
  font-weight: var(--phoa-fw-bold);
  font-size: 14px;
  padding: 0 18px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-xs {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--phoa-primary);
  border-color: var(--phoa-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--phoa-primary-hover);
  border-color: var(--phoa-primary-hover);
  color: #fff;
}

.btn-secondary,
.btn-lighter,
.btn-light {
  background: #fff;
  border: 1px solid var(--phoa-border-input);
  color: var(--phoa-secondary);
}

.btn-secondary:hover,
.btn-lighter:hover,
.btn-light:hover {
  border-color: var(--phoa-primary);
  color: var(--phoa-primary);
  background: #fff;
}

.btn-danger {
  background: var(--phoa-danger-text);
  border-color: var(--phoa-danger-text);
  color: #fff;
}

.btn-danger:hover,
.btn-danger:focus {
  background: #D33A3F;
  border-color: #D33A3F;
  color: #fff;
}

.btn-outline {
  background: #fff;
}

.btn-outline.btn-success {
  border: 1px solid var(--phoa-success-text);
  color: var(--phoa-success-text);
}

/* Small icon-only action buttons (row actions in tables) */
.btn-icon {
  border-radius: 8px !important;
  padding: 0 !important;
}

.btn-light-alt.btn-icon {
  border: none;
}

.btn-light-alt.btn-icon.btn-primary {
  background: var(--phoa-subtle-4);
  color: var(--phoa-muted-1) !important;
}

.btn-light-alt.btn-icon.btn-primary:hover {
  background: var(--phoa-secondary);
  color: #fff !important;
}

.btn-light-alt.btn-icon.btn-danger {
  background: var(--phoa-danger-bg);
  color: var(--phoa-danger-text) !important;
}

.btn-light-alt.btn-icon.btn-danger:hover {
  background: var(--phoa-danger-text);
  color: #fff !important;
}

.btn-light-alt.btn-icon.btn-info {
  background: var(--phoa-primary-tint-3);
  color: var(--phoa-primary) !important;
}

.btn-light-alt.btn-icon.btn-info:hover {
  background: var(--phoa-primary);
  color: #fff !important;
}

.btn-light-alt.btn-icon.btn-success {
  background: var(--phoa-success-bg);
  color: var(--phoa-success-text) !important;
}

.btn-light-alt.btn-icon.btn-success:hover {
  background: var(--phoa-success-text);
  color: #fff !important;
}

.btn-light-alt.btn-icon.btn-secondary {
  background: var(--phoa-purple-bg);
  color: var(--phoa-purple-text) !important;
}

.btn-light-alt.btn-icon.btn-secondary:hover {
  background: var(--phoa-purple-text);
  color: #fff !important;
}

.btn-light-alt.btn-icon.btn-warning {
  background: var(--phoa-warning-bg-2);
  color: #C08A1E !important;
}

.btn-light-alt.btn-icon.btn-warning:hover {
  background: #C08A1E;
  color: #fff !important;
}

.btn-add-first {
  margin-top: 8px;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */

.form-label,
label.form-label {
  font-size: 13px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-secondary);
  margin-bottom: 7px;
}

.form-label-wrapper .form-help-text {
  display: block;
  font-size: 12px;
  color: var(--phoa-muted-4);
  margin-top: -3px;
  margin-bottom: 7px;
}

.form-control,
.form-select,
select.input-bordered,
input.input-bordered {
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--phoa-border-input);
  border-radius: var(--phoa-r-input);
  font-size: 14px;
  color: var(--phoa-text);
  font-family: var(--phoa-font);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

textarea.form-control {
  height: auto;
  padding: 13px;
}

.form-control:focus,
.form-select:focus,
select.input-bordered:focus,
input.input-bordered:focus {
  border-color: var(--phoa-primary);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.12);
}

/* Global select-arrow fix: several selects across the app render
   with only .form-control (not Bootstrap's .form-select, which is
   the class that actually ships a chevron background-image), and
   our uniform 13px padding also crowds out Bootstrap's own arrow
   where it is present. Force one consistent chevron on every
   plain single-select site-wide rather than depending on which
   class happened to get used. */
select.form-control,
select.form-select,
select.input-bordered,
select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238892A8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  padding-right: 38px !important;
}

.input-group-text {
  border: 1px solid var(--phoa-border-input);
  background: var(--phoa-subtle-1);
  color: var(--phoa-muted-2);
}

/* Toggle switches (form-switch) — match the design's pill toggle.
   Bootstrap sizes .form-check's padding-left/the input's negative
   margin around its default 2em-wide switch; since ours is wider
   (44px) we need to redeclare both sides of that math, or the
   label ends up overlapping/hugging the switch. */
.form-check.form-switch {
  display: flex;
  align-items: center;
  padding-left: 54px;
  min-height: 26px;
}

.form-check.form-switch .form-check-input {
  width: 44px;
  height: 26px;
  margin-left: -54px;
  margin-top: 0;
  flex-shrink: 0;
  background-color: var(--phoa-muted-5);
  border: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  cursor: pointer;
}

.form-check.form-switch .form-check-label {
  padding-left: 10px;
  cursor: pointer;
}

.form-check.form-switch .form-check-input:checked {
  background-color: var(--phoa-primary);
  border-color: var(--phoa-primary);
}

.form-check.form-switch .form-check-input:focus {
  border-color: var(--phoa-primary);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.12);
}

.form-check-input[type="checkbox"]:not(.form-switch .form-check-input) {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--phoa-border-input);
}

.form-check-input:checked {
  background-color: var(--phoa-primary);
  border-color: var(--phoa-primary);
}

.form-check-label {
  font-size: 13.5px;
  color: var(--phoa-secondary);
}

/* ============================================================
   PROFILE PHOTO UPLOAD AVATAR (contact/vendor/unit detail headers)
   Bootstrap's .img-thumbnail adds padding + a hard border box that
   reads as a boxed-in thumbnail rather than a seamless circular
   avatar — strip that, keep the upload mechanism as-is.
   ============================================================ */

/* ============================================================
   DETAIL HEADER (contact/vendor/unit "view contact" style pages)
   Single unified card: avatar + name/badge/subtitle + actions,
   then tabs, then tab content — all inside one .card, matching
   the design (not a separate card per section).
   ============================================================ */

.contact-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 20px;
}

.contact-detail-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.contact-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-detail-avatar-initials {
  background: var(--phoa-primary);
  color: #fff;
  font-size: 26px;
  font-weight: var(--phoa-fw-extrabold);
}

.contact-detail-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(28, 37, 64, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.contact-detail-avatar-wrap:hover .contact-detail-avatar-overlay {
  opacity: 1;
}

.contact-detail-identity {
  flex: 1;
  min-width: 200px;
}

.contact-detail-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-detail-subtitle {
  font-size: 14px;
  color: var(--phoa-muted-3);
  margin-top: 5px;
}

.contact-detail-actions {
  flex-shrink: 0;
}

.contact-type-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.02em;
  background: var(--phoa-primary-tint-3);
  color: var(--phoa-primary);
  cursor: pointer;
  transition: filter 0.12s ease;
}

.contact-type-pill:hover {
  filter: brightness(0.96);
}

.contact-toggle-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-display-title {
  font-size: 22px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: -0.01em;
  color: var(--phoa-navy);
  margin: 0;
}

/* Read-only "Contact Information" view panel (default state,
   toggled to the edit form via view-edit-toggle-controller). */
.contact-info-view {
  border: 1px solid var(--phoa-border);
  border-radius: 12px;
  overflow: hidden;
}

.contact-info-view-eyebrow {
  background: var(--phoa-subtle-1);
  border-bottom: 1px solid var(--phoa-subtle-5);
  padding: 13px 20px;
  font-size: 12px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--phoa-muted-4);
}

.contact-info-view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 26px;
  padding: 22px 20px;
}

@media (max-width: 767px) {
  .contact-info-view-grid {
    grid-template-columns: 1fr;
  }
}

.contact-info-view-label {
  font-size: 12px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-muted-4);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.contact-info-view-value {
  font-size: 14.5px;
  color: var(--phoa-text);
  margin-top: 6px;
}

.contact-info-view-value-link {
  color: var(--phoa-primary);
  word-break: break-all;
}

/* ============================================================
   BREADCRUMB (above the detail card, e.g. "Contacts / Cindy Lee")
   ============================================================ */

.contact-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.contact-breadcrumb a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--phoa-primary);
  font-weight: var(--phoa-fw-bold);
  text-decoration: none;
}

.contact-breadcrumb a:hover {
  text-decoration: underline;
}

.contact-breadcrumb-sep {
  color: var(--phoa-muted-5);
}

.contact-breadcrumb-current {
  color: var(--phoa-muted-1);
  font-weight: var(--phoa-fw-semibold);
}

/* Tabs bottom border bleeds to the card's outer edge (card-innr has
   side padding; without this the border only spans the tabs' own
   content width, not the full card, unlike the design). */
.nav-tabs-line {
  margin-left: -24px !important;
  margin-right: -24px !important;
  padding: 0 24px;
  border-bottom: 1px solid var(--phoa-subtle-5) !important;
}

.contact-tab-content {
  padding-top: 24px;
}

.contact-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.contact-tab-title {
  font-size: 17px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  margin: 0;
}

/* ============================================================
   PAGE CARD WRAPPER (content-area / card.shadow used to wrap
   list + detail pages) — matches the design's white card look.
   ============================================================ */

.page-content .card.shadow,
.page-content .content-area.card {
  border: 1px solid var(--phoa-border);
  border-radius: 16px;
  box-shadow: none;
}

.page-content .card-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--phoa-subtle-5);
  background: transparent;
}

.page-content .card-header .card-title {
  font-size: 20px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  letter-spacing: -0.01em;
}

.page-content .card-innr {
  padding: 20px 24px;
}

/* ============================================================
   TABS (nav-tabs-line — contact/vendor/unit detail pages)
   ============================================================ */

.nav-tabs-line {
  border-bottom: none;
  gap: 0;
  margin-bottom: 0 !important;
}

.nav-tabs-line .nav-item {
  padding: 0 !important;
}

.nav-tabs-line .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 11px 4px;
  margin-right: 24px;
  font-size: 13.5px;
  font-weight: var(--phoa-fw-semibold);
  color: var(--phoa-muted-2);
  text-transform: none;
  letter-spacing: normal;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tabs-line .nav-link:after {
  display: none;
}

.nav-tabs-line .nav-link i,
.nav-tabs-line .nav-link svg {
  font-size: 14px;
}

.nav-tabs-line .nav-link:hover {
  color: var(--phoa-heading);
  border-color: transparent;
}

.nav-tabs-line .nav-link.active {
  color: var(--phoa-primary);
  border-bottom-color: var(--phoa-primary);
  background: transparent;
  font-weight: var(--phoa-fw-bold);
}

/* ============================================================
   TABLES (list pages using .table.table-striped)
   ============================================================ */

.table-responsive .table {
  margin-bottom: 0;
}

.table thead th {
  border: none;
  border-bottom: 1px solid var(--phoa-subtle-5);
  background: var(--phoa-subtle-3);
  font-size: 11px;
  font-weight: var(--phoa-fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--phoa-muted-2);
  padding: 12px 16px;
  white-space: nowrap;
}

.table thead th a {
  color: inherit;
  text-decoration: none;
}

.table.table-striped > tbody > tr {
  background: transparent;
}

.table.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: transparent;
}

.table tbody tr {
  border-bottom: 1px solid var(--phoa-subtle-5);
  transition: background-color 0.1s ease;
}

.table tbody tr:hover {
  background: var(--phoa-subtle-2);
}

.table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  border: none;
  font-size: 14px;
  color: var(--phoa-secondary);
}

.contact-name-link,
.contact-name-link strong {
  color: var(--phoa-primary);
  font-weight: var(--phoa-fw-bold);
  text-decoration: none;
}

.contact-name-link:hover {
  text-decoration: underline;
}

.contact-email,
.contact-phone {
  color: var(--phoa-primary);
  text-decoration: none;
}

.contact-email:hover,
.contact-phone:hover {
  text-decoration: underline;
}

.no-data {
  color: var(--phoa-muted-5);
}

/* ============================================================
   BADGES
   ============================================================ */

.contact-type-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: none !important;
}

.contact-type-badge.type-1 {
  background: var(--phoa-primary-tint-3);
  color: var(--phoa-primary);
}

.contact-type-badge.type-2 {
  background: var(--phoa-success-bg);
  color: var(--phoa-success-text);
}

.contact-type-badge.type-3 {
  background: var(--phoa-warning-bg-2);
  color: #C08A1E;
}

.contact-type-badge.type-4 {
  background: var(--phoa-purple-bg);
  color: #7A5BE0;
}

.doc-visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: none !important;
  white-space: nowrap;
}

.doc-visibility-badge.visibility-all_residents {
  background: var(--phoa-success-bg);
  color: var(--phoa-success-text);
}

.doc-visibility-badge.visibility-board_only {
  background: var(--phoa-warning-bg-2);
  color: #C08A1E;
}

.doc-visibility-badge.visibility-system_only {
  background: var(--phoa-danger-bg);
  color: var(--phoa-danger-text);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  padding: 64px 20px;
  text-align: center;
}

.empty-state .empty-icon {
  color: var(--phoa-muted-5);
}

.empty-state .empty-title {
  font-size: 17px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  margin-top: 16px;
}

.empty-state .empty-description {
  font-size: 14px;
  color: var(--phoa-muted-3);
  margin-top: 6px;
  line-height: 1.6;
}

/* ============================================================
   FILTER PANEL
   ============================================================ */

.page-content [data-controller="filter-toggle"] > div:first-child {
  margin-bottom: 0;
}

.page-content [data-filter-toggle-target="content"] form {
  background: var(--phoa-subtle-3);
  border: 1px solid var(--phoa-border);
  border-radius: 12px;
  padding: 18px;
  margin-top: 12px !important;
}

/* ============================================================
   GENERIC BREADCRUMB (above a form/detail page header, e.g.
   "Units / New") — same visual as contact-breadcrumb, aliased
   under a non-contact-specific name for reuse on other entities.
   ============================================================ */

.contact-breadcrumb,
.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.contact-breadcrumb a,
.page-breadcrumb a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--phoa-primary);
  font-weight: var(--phoa-fw-bold);
  text-decoration: none;
}

.contact-breadcrumb a:hover,
.page-breadcrumb a:hover {
  text-decoration: underline;
}

.contact-breadcrumb-sep,
.page-breadcrumb-sep {
  color: var(--phoa-muted-5);
}

.contact-breadcrumb-current,
.page-breadcrumb-current {
  color: var(--phoa-muted-1);
}

/* ============================================================
   FORM PAGE (Add Unit, and other "create new X" pages): a
   breadcrumb + title/actions header above a two-column grid —
   a flexible main card and a fixed-width sidebar of mini-cards.
   ============================================================ */

.form-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.form-page-title {
  font-size: 22px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: -0.01em;
  color: var(--phoa-navy);
  margin: 0;
}

.form-page-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.form-page-grid {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

@media (max-width: 991px) {
  .form-page-grid {
    grid-template-columns: 1fr;
  }
}

.form-page-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-page-sidebar .card {
  border: 1px solid var(--phoa-border);
  border-radius: 16px;
  box-shadow: none;
}

.form-page-sidebar .card-innr {
  padding: 22px 24px;
}

.form-page-sidebar-title {
  font-size: 15px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  margin-bottom: 16px;
}

.form-page-section-title {
  font-size: 16px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  margin-bottom: 20px;
}

.form-page-divider {
  height: 1px;
  background: var(--phoa-border-divider);
  margin-bottom: 20px;
}

/* ============================================================
   LIST PAGE HEADER + TOOLBAR (Units and other list pages: title
   + subtitle + actions above a search/view-toggle toolbar row).
   ============================================================ */

.list-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.list-page-title {
  font-size: 20px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: -0.01em;
  color: var(--phoa-navy);
  margin: 0;
}

.list-page-subtitle {
  font-size: 13px;
  color: var(--phoa-muted-3);
  margin-top: 2px;
}

.list-page-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.list-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.search-input-wrap .form-control {
  width: 100%;
  padding-left: 38px;
}

.search-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--phoa-muted-5);
  display: flex;
  pointer-events: none;
}

.view-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--phoa-subtle-4);
  border: 1px solid var(--phoa-border);
  border-radius: 10px;
  flex-shrink: 0;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-muted-3);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.view-toggle-btn:hover {
  color: var(--phoa-secondary);
  text-decoration: none;
}

.view-toggle-btn.active {
  background: #fff;
  color: var(--phoa-primary);
  box-shadow: 0 1px 3px rgba(20, 30, 70, 0.12);
}

/* ============================================================
   UNIT MINI-CARDS (Units cards view)
   ============================================================ */

.unit-card {
  border: 1px solid var(--phoa-border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  height: 100%;
}

.unit-card-photo {
  display: block;
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--phoa-subtle-4);
  position: relative;
}

.unit-card-photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 37, 64, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: var(--phoa-fw-bold);
  opacity: 0;
  transition: opacity 0.15s ease;
  text-decoration: none;
}

.unit-card-photo:hover .unit-card-photo-overlay {
  opacity: 1;
  color: #fff;
}

.unit-card-body {
  padding: 18px 20px;
}

.unit-card-address {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.unit-card-address-icon {
  color: var(--phoa-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.unit-card-address-line1 {
  font-size: 14px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-text);
}

.unit-card-address-line2 {
  font-size: 12.5px;
  color: var(--phoa-muted-3);
  margin-top: 2px;
}

.unit-card-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--phoa-muted-1);
  padding-top: 12px;
  border-top: 1px solid var(--phoa-subtle-5);
  margin-bottom: 14px;
}

.unit-card-balance-value {
  font-weight: var(--phoa-fw-extrabold);
}

.unit-card-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================
   UNIT DETAIL HERO (photo + title/badge + subtitle + stats +
   actions, above the tab bar).
   ============================================================ */

.unit-detail-photo-wrap {
  position: relative;
  width: 120px;
  height: 88px;
  flex-shrink: 0;
}

.unit-detail-photo {
  width: 120px;
  height: 88px;
  border-radius: 12px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--phoa-subtle-4);
  color: var(--phoa-muted-4);
  font-size: 24px;
}

.unit-detail-photo-overlay {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(28, 37, 64, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.unit-detail-photo-wrap:hover .unit-detail-photo-overlay {
  opacity: 1;
}

.unit-status-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.unit-status-pill.status-current {
  background: var(--phoa-success-bg);
  color: var(--phoa-success-text);
  border: 1px solid #CDEBD9;
}

.unit-status-pill.status-past-due {
  background: var(--phoa-danger-bg);
  color: var(--phoa-danger-text);
  border: 1px solid #F6C9CD;
}

.unit-status-pill.status-deleted {
  background: var(--phoa-warning-bg-2);
  color: var(--phoa-warning-text-2);
  border: 1px solid #F4E3BE;
}

.unit-detail-stats {
  display: flex;
  gap: 22px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.unit-detail-stat-label {
  font-size: 11px;
  font-weight: var(--phoa-fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--phoa-muted-4);
}

.unit-detail-stat-value {
  font-size: 18px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-text);
  margin-top: 2px;
}

/* ============================================================
   TAGIFY (tag input widget — unit/contact tags). Tagify copies
   the original <input>'s classes (incl. our global .form-control)
   onto its own wrapper <tags> element, so the fixed height/padding
   from .form-control clips its multi-line tag layout instead of
   letting the box grow — tags spill above/below instead of
   wrapping inside it. Reset the box model here and restyle with
   Tagify's own CSS custom properties to match our design tokens.
   ============================================================ */
tags.tagify.form-control,
.tagify.form-control {
  --tags-border-color: var(--phoa-border-input);
  --tags-hover-border-color: var(--phoa-muted-5);
  --tags-focus-border-color: var(--phoa-primary);
  --tag-bg: var(--phoa-primary-tint-3);
  --tag-hover: var(--phoa-primary-tint-2);
  --tag-text-color: var(--phoa-primary);
  --tag-text-color--edit: var(--phoa-text);
  --tag-pad: 5px 10px;
  --tag-border-radius: 6px;
  --tag-remove-bg: transparent;
  --tag-remove-btn-bg--hover: transparent;
  --tag-remove-btn-color: var(--phoa-primary);
  --placeholder-color: var(--phoa-muted-4);
  --input-color: var(--phoa-text);
  height: auto;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--phoa-r-input);
  font-family: var(--phoa-font);
  font-size: 14px;
}

.tagify__input {
  margin: 4px;
  font-family: var(--phoa-font);
}

.tagify__tag {
  margin: 4px;
}

/* ============================================================
   MESSAGE CONTACT MODAL (Send Via method picker + dynamic
   email/sms/letter fields, all in one live-switching form).
   ============================================================ */

.card-head .btn-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--phoa-subtle-4);
  background-size: 13px;
  opacity: 1;
  flex-shrink: 0;
  transition: background-color 0.12s ease;
}

.card-head .btn-close:hover {
  background-color: var(--phoa-primary-tint);
}

.message-method-eyebrow {
  font-size: 11px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--phoa-muted-4);
  margin-bottom: 10px;
}

.message-method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.message-method-card {
  border: 1px solid var(--phoa-border-input);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.message-method-card:hover {
  border-color: var(--phoa-muted-5);
}

.message-method-card.active {
  border-color: var(--phoa-primary);
  background: var(--phoa-primary-tint-2);
}

.message-method-card.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.message-method-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--phoa-subtle-4);
  color: var(--phoa-muted-2);
  font-size: 14px;
  margin-bottom: 10px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.message-method-card.active .message-method-icon {
  background: var(--phoa-primary);
  color: #fff;
}

.message-method-label {
  font-size: 14px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-text);
}

.message-method-detail {
  font-size: 12px;
  color: var(--phoa-muted-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-unit-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--phoa-border-input);
  border-radius: 10px;
  margin-bottom: 18px;
}

.message-modal-sent {
  text-align: center;
  padding: 20px 10px 4px;
}

.message-modal-sent-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--phoa-success-bg);
  color: var(--phoa-success-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.message-modal-sent-title {
  font-size: 18px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-navy);
  margin-bottom: 6px;
}

.message-modal-sent-text {
  font-size: 13.5px;
  color: var(--phoa-muted-3);
  margin-bottom: 20px;
}

.message-field-group {
  margin-bottom: 20px;
}

.message-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.message-field-header .form-label {
  margin-bottom: 0;
}

/* Own our padding instead of depending on the ambient .modal-body — that
   rule was landing inconsistently across this modal's different render
   paths (initial load vs. turbo-stream re-render), so zero it out here
   and pad ourselves instead. */
.modal-body:has(.message-modal-body) {
  padding: 0;
}

.message-modal-body {
  padding: 24px 26px;
}

.message-modal-body .modal-footer {
  margin: 20px -26px -24px;
}

/* ============================================================
   DOCUMENT BROWSER — tinted rounded-square icon containers
   (folder rows get a blue tint; file rows get a neutral tint)
   ============================================================ */

.doc-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-icon-folder {
  background: var(--phoa-primary-tint-2);
  color: var(--phoa-primary);
  font-size: 18px;
}

.doc-icon-file {
  background: var(--phoa-subtle-4);
}

.doc-icon-file img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

