/* HONNE CORE mobile layouts: purposeful controls and scannable record cards. */
.mobile-filter-toggle { display: none; }
.mobile-filter-fields { display: contents; }
.mobile-filter-fields[hidden] { display: none !important; }

/* Flattened filter children keep the original desktop filter layout. */
@media (min-width: 1151px) {
  html body .properties-content .property-toolbar {
    grid-template-columns: minmax(230px, 2fr) repeat(4, minmax(112px, 1fr)) minmax(100px, auto);
  }
  html body .properties-content .property-toolbar > .search-box,
  html body .properties-content .mobile-filter-fields > .clear-filters { grid-column: auto; }
}
@media (min-width: 681px) and (max-width: 1150px) {
  html body .properties-content .property-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html body .properties-content .property-toolbar > .search-box { grid-column: 1 / -1; }
  html body .properties-content .mobile-filter-fields > .clear-filters { grid-column: 2 / -1; }
}

@media (max-width: 680px) {
  :root {
    --mobile-surface: #fffefa;
    --mobile-raised: #f6f4ee;
    --mobile-border: #ded9ce;
    --mobile-muted: #706b61;
    --mobile-ink: #201e19;
    --mobile-shadow: 0 10px 26px rgba(31, 26, 18, .06);
  }
  html[data-theme="dark"] {
    --mobile-surface: #1b1b1a;
    --mobile-raised: #24231f;
    --mobile-border: #3b3933;
    --mobile-muted: #bbb5aa;
    --mobile-ink: #f4f0e9;
    --mobile-shadow: 0 12px 30px rgba(0, 0, 0, .22);
  }

  .main-content:not(.home-content) { padding-inline: 14px; }
  .main-content > .topbar :is(.new-property-button, .new-preproperty, .primary-action) {
    min-height: 48px;
    justify-content: center;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 750;
  }

  /* Inventories: one search field, one optional filter drawer, and quiet counts. */
  html body .properties-content .inventory-tabs,
  html body .preproperties-content .preproperty-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 17px;
    padding: 5px;
    overflow: visible;
    border: 1px solid var(--mobile-border);
    border-radius: 15px;
    background: var(--mobile-raised);
    box-shadow: none;
  }
  html body .preproperties-content .preproperty-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html body .properties-content .inventory-tabs a,
  html body .preproperties-content .preproperty-tabs a {
    display: flex;
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 3px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--mobile-muted);
    box-shadow: none;
    text-align: center;
  }
  html body .properties-content .inventory-tabs a.is-active,
  html body .preproperties-content .preproperty-tabs a.is-active,
  html[data-theme="dark"] body .properties-content .inventory-tabs a.is-active,
  html[data-theme="dark"] body .preproperties-content .preproperty-tabs a.is-active {
    background: var(--mobile-surface);
    color: var(--mobile-ink);
    box-shadow: var(--mobile-shadow);
  }
  html body .properties-content .inventory-tabs span,
  html body .preproperties-content .preproperty-tabs a { font-size: 11px; font-weight: 700; line-height: 1.2; }
  html body .properties-content .inventory-tabs strong,
  html body .preproperties-content .preproperty-tabs strong {
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(160, 140, 91, .14);
    color: var(--mobile-ink);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
  }

  html body .properties-content .property-list-card,
  html body .preproperties-content .preproperty-card {
    margin-top: 12px;
    overflow: visible;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  html body .properties-content .property-toolbar,
  html body .preproperties-content .preproperty-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 0;
    border: 0;
    background: transparent;
  }
  html body .properties-content .property-toolbar > *,
  html body .preproperties-content .preproperty-toolbar > * { width: 100%; min-width: 0; }
  html body .properties-content .search-box,
  html body .preproperties-content .preproperty-toolbar > label {
    min-height: 50px;
    padding-inline: 15px;
    border: 1px solid var(--mobile-border);
    border-radius: 12px;
    background: var(--mobile-surface);
    color: var(--mobile-muted);
    box-shadow: var(--mobile-shadow);
  }
  html body .properties-content .search-box > span,
  html body .preproperties-content .preproperty-toolbar > label > span { color: #b69342; font-size: 22px; }
  html body .properties-content .search-box input,
  html body .preproperties-content .preproperty-toolbar > label input {
    min-width: 0;
    min-height: 46px;
    font-size: 16px;
  }
  html body .properties-content .search-box input::placeholder,
  html body .preproperties-content .preproperty-toolbar > label input::placeholder { color: var(--mobile-muted); font-size: 13px; }

  .mobile-filter-toggle {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 9px;
    padding: 0 13px;
    border: 1px solid var(--mobile-border);
    border-radius: 11px;
    background: var(--mobile-surface);
    color: var(--mobile-ink);
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
  }
  .mobile-filter-icon { color: #b69342; font-size: 20px; line-height: 1; }
  .mobile-filter-count {
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding-inline: 4px;
    border-radius: 10px;
    background: #e8c667;
    color: #171511;
    font-size: 11px;
  }
  .mobile-filter-count[hidden] { display: none; }
  .mobile-filter-chevron { margin-left: auto; font-size: 18px; transition: transform .2s; }
  .mobile-filter-toggle[aria-expanded="true"] .mobile-filter-chevron { transform: rotate(180deg); }
  .mobile-filter-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--mobile-border);
    border-radius: 12px;
    background: var(--mobile-surface);
  }
  .mobile-filter-fields > * { min-width: 0; width: 100%; }
  html body .properties-content .mobile-filter-fields :is(.prefix-filter summary, select, button),
  html body .preproperties-content .mobile-filter-fields :is(select, button) {
    min-height: 45px;
    border: 1px solid var(--mobile-border);
    border-radius: 9px;
    background: var(--mobile-raised);
    color: var(--mobile-ink);
    font-size: 14px;
  }
  html body .properties-content .mobile-filter-fields select,
  html body .preproperties-content .mobile-filter-fields select { padding-inline: 12px 32px; }
  html body .properties-content .prefix-filter > div {
    position: static;
    width: 100%;
    max-height: 220px;
    margin-top: 5px;
    border-radius: 9px;
    border-color: var(--mobile-border);
    background: var(--mobile-raised);
    box-shadow: none;
  }
  html body .properties-content .clear-filters,
  html body .preproperties-content #clear-pre-filters { font-weight: 700; }

  /* People directories: identity leads, metadata is grouped, actions stay finger-sized. */
  .agents-content .agents-summary { gap: 8px; margin: 15px 0; border: 0; background: transparent; }
  .agents-content .agents-summary > div {
    min-height: 82px;
    padding: 15px 17px;
    border: 1px solid var(--mobile-border);
    border-radius: 13px;
    background: var(--mobile-surface);
    box-shadow: var(--mobile-shadow);
  }
  .agents-content .agents-summary > p {
    padding: 10px 2px;
    border: 0;
    color: var(--mobile-muted);
    font-size: 12px;
    line-height: 1.5;
  }
  .agents-content .agents-card,
  .management-content .management-card {
    overflow: visible;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .agents-content .agents-table-wrap,
  .management-content .management-table-wrap,
  html body .properties-content .properties-table-wrap,
  html body .preproperties-content .preproperty-table-wrap {
    overflow: visible;
    background: transparent !important;
  }
  .agents-content .agents-toolbar,
  .management-content .management-toolbar {
    gap: 8px;
    padding: 0 0 12px;
    border: 0;
    background: transparent;
  }
  .agents-content .agents-toolbar :is(input, select),
  .management-content .management-toolbar :is(input, select) {
    min-height: 48px;
    padding-inline: 14px;
    border: 1px solid var(--mobile-border);
    border-radius: 11px;
    background: var(--mobile-surface);
    color: var(--mobile-ink);
    font-size: 15px;
  }
  .agents-content .agents-toolbar input::placeholder,
  .management-content .management-toolbar input::placeholder { color: var(--mobile-muted); font-size: 13px; }
  .management-content .directory-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 10px;
    padding: 5px;
    border: 1px solid var(--mobile-border);
    border-radius: 13px;
    background: var(--mobile-raised);
  }
  .management-content .directory-tabs button {
    min-height: 42px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--mobile-muted);
    font-size: 13px;
    font-weight: 700;
  }
  .management-content .directory-tabs button[aria-selected="true"] {
    background: var(--mobile-surface);
    color: var(--mobile-ink);
    box-shadow: var(--mobile-shadow);
  }
  .agents-content .agents-card table,
  .agents-content .agents-card tbody,
  .management-content .management-card table,
  .management-content .management-card tbody { background: transparent; }
  .agents-content .agents-table tbody,
  .management-content .management-card tbody { display: grid; gap: 10px; }
  .agents-content .agents-table tbody tr,
  .management-content .management-card tbody tr,
  html body .properties-content .properties-table tbody tr,
  html body .preproperties-content .preproperty-card tbody tr {
    margin: 0;
    padding: 16px !important;
    border: 1px solid var(--mobile-border);
    border-radius: 14px;
    background: var(--mobile-surface);
    box-shadow: var(--mobile-shadow);
  }
  .agents-content .agents-table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
  }
  .agents-content .agents-table td:first-child {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }
  .agents-content .agents-table td:first-child::before,
  .agents-content .agents-table td:nth-child(2)::before { display: none; }
  .agents-content .agents-table td:first-child strong {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 7px;
    background: var(--mobile-raised);
    color: var(--mobile-muted);
    font-size: 11px;
    letter-spacing: .07em;
  }
  .agents-content .agents-table td:nth-child(2) { grid-column: 1; grid-row: 1; }
  .agents-content .agent-identity { min-width: 0; gap: 10px; }
  .agents-content .agent-avatar { width: 40px; height: 40px; flex-basis: 40px; }
  .agents-content .agent-identity strong { display: block; font-size: 14px; line-height: 1.3; }
  .agents-content .agents-table td:nth-child(n+3):nth-child(-n+6),
  .management-content .management-card td:not(:first-child):not(:last-child) {
    min-width: 0;
    color: var(--mobile-ink);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .agents-content .agents-table td:nth-child(n+3):nth-child(-n+6) { grid-column: auto; }
  .agents-content .agents-table td:nth-child(n+3)::before,
  .management-content .management-card td:not(:first-child):not(:last-child)::before,
  html body .properties-content .properties-table td:nth-child(n+2):nth-child(-n+6)::before,
  html body .preproperties-content .preproperty-card td:nth-child(n+3):nth-child(-n+6)::before {
    margin-bottom: 4px;
    color: var(--mobile-muted);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .045em;
    line-height: 1.2;
  }
  .agents-content .agents-table td:nth-child(3)::before { content: "TELÉFONO"; }
  .agents-content .agents-table td:nth-child(4)::before { content: "INGRESO"; }
  .agents-content .agents-table td:nth-child(5)::before { content: "ESTADO"; }
  .agents-content .agents-table td:nth-child(6)::before { content: "SALIDA"; }
  html body .properties-content .properties-table td:nth-child(2)::before { content: "UBICACIÓN"; }
  html body .properties-content .properties-table td:nth-child(3)::before { content: "OPERACIÓN"; }
  html body .properties-content .properties-table td:nth-child(4)::before { content: "PRECIO"; }
  html body .properties-content .properties-table td:nth-child(5)::before { content: "ESTADO"; }
  html body .properties-content .properties-table td:nth-child(6)::before { content: "ACTUALIZADO"; }
  html body .preproperties-content .preproperty-card td:nth-child(3)::before { content: "UBICACIÓN"; }
  html body .preproperties-content .preproperty-card td:nth-child(4)::before { content: "PROCESOS"; }
  html body .preproperties-content .preproperty-card td:nth-child(5)::before { content: "ESTADO"; }
  html body .preproperties-content .preproperty-card td:nth-child(6)::before { content: "ACTUALIZADO"; }
  .agents-content .agents-table td:last-child,
  .management-content .management-card td:last-child {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding-top: 11px !important;
    border-top: 1px solid var(--mobile-border) !important;
  }
  .agents-content .agent-row-actions button,
  .management-content .management-actions button {
    min-height: 44px;
    border-radius: 9px;
    background: var(--mobile-raised);
    font-size: 13px;
    font-weight: 750;
  }
  .management-content .management-card td:first-child {
    padding-bottom: 11px !important;
    border-bottom: 1px solid var(--mobile-border) !important;
  }
  .management-content .management-card td:first-child strong { font-size: 15px; }

  /* Property and precapture records use independent cards instead of a table slab. */
  html body .properties-content .properties-table,
  html body .preproperties-content .preproperty-card table { background: transparent; }
  html body .properties-content .properties-table tbody,
  html body .preproperties-content .preproperty-card tbody { display: grid; gap: 10px; padding-top: 12px; }
  html body .properties-content .properties-table tbody tr,
  html body .preproperties-content .preproperty-card tbody tr { gap: 12px; }
  html body .properties-content .properties-table td,
  html body .preproperties-content .preproperty-card td { color: var(--mobile-ink); font-size: 12px; line-height: 1.45; }
  html body .properties-content .property-identity strong { font-size: 14px; }
  html body .properties-content .property-thumb { border-radius: 9px; }
  html body .properties-content .properties-table td:last-child,
  html body .preproperties-content .preproperty-card td:last-child { top: 14px; right: 14px; }
  html body .properties-content .properties-empty,
  html body .preproperties-content .pre-empty { padding: 45px 20px; border: 1px solid var(--mobile-border); border-radius: 14px; background: var(--mobile-surface); }
}

@media (max-width: 360px) {
  html body .properties-content .inventory-tabs span { font-size: 10px; }
  .agents-content .agents-table tbody tr,
  .management-content .management-card tbody tr { gap: 10px 8px; padding: 13px !important; }
}
