/* ============================================================================
   THEO PROPERTIES — RC1.0.15.129.4
   ADMIN TENANCY MOBILE EXPERIENCE CLEANUP & COMPACT SURFACE LOCK
   Mobile-only presentation authority for Tenancy Management.
   Baseline: RC1.0.15.129.3. No runtime/data/workflow changes.
   ============================================================================ */

@media (max-width:700px){
  /* Scope every override to the Tenancy Management view only. */
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]){
    --tp-tenancy-gap:10px;
    overflow-x:hidden!important;
  }

  /* Compact 2x2 tenancy KPI rail. */
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-strip{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    margin:0 0 12px!important;
  }
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-cell{
    min-height:88px!important;
    padding:12px 13px!important;
    border-radius:14px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:auto 1fr auto!important;
    align-items:start!important;
    column-gap:8px!important;
  }
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-cell>span{
    grid-column:1!important;
    grid-row:1!important;
    margin:0!important;
    font-size:8px!important;
    line-height:1.15!important;
    letter-spacing:.065em!important;
  }
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-cell>strong{
    grid-column:2!important;
    grid-row:1/3!important;
    align-self:start!important;
    margin:-1px 0 0!important;
    font-size:24px!important;
    line-height:1!important;
  }
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-cell>small{
    grid-column:1/-1!important;
    grid-row:3!important;
    align-self:end!important;
    margin:8px 0 0!important;
    font-size:9.5px!important;
    line-height:1.25!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
  }

  /* Tenancy panels: compact headers with deliberate spacing. */
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]),
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel{
    width:100%!important;
    min-width:0!important;
    margin:0 0 12px!important;
    border-radius:16px!important;
    overflow:hidden!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-panel-head,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .panel-head{
    display:block!important;
    width:100%!important;
    padding:14px!important;
    box-sizing:border-box!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-panel-head>div:first-child,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .panel-head>div:first-child{
    width:100%!important;
    min-width:0!important;
    margin:0!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .panel-head h3,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .panel-head h3{
    margin:0!important;
    font-size:15px!important;
    line-height:1.2!important;
    letter-spacing:-.02em!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .panel-context,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .panel-context{
    display:block!important;
    margin-top:4px!important;
    font-size:9px!important;
    line-height:1.25!important;
  }

  /* Search + view filters: compact, not a large nested form card. */
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-toolbar{
    display:grid!important;
    grid-template-columns:1fr!important;
    width:100%!important;
    margin:11px 0 0!important;
    padding:9px!important;
    gap:8px!important;
    border-radius:12px!important;
    background:#f8fbfc!important;
    border:1px solid #e1e9ed!important;
    box-shadow:none!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-filter-search,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-filter-field{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-filter-search input,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-filter-field select{
    width:100%!important;
    height:43px!important;
    min-height:43px!important;
    padding:0 12px!important;
    border-radius:10px!important;
    font-size:13px!important;
    line-height:1!important;
    background-color:#fff!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-filter-field>span{
    margin:0 0 5px!important;
    font-size:7.5px!important;
    line-height:1!important;
  }

  /* Both tenancy tables become semantic mobile cards. */
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .table-wrap,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .table-wrap{
    width:100%!important;
    min-width:0!important;
    padding:0 14px 14px!important;
    border:0!important;
    background:transparent!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    table-layout:auto!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table thead,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table thead{
    display:none!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table tbody,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table tbody{
    display:grid!important;
    grid-template-columns:1fr!important;
    width:100%!important;
    min-width:0!important;
    gap:9px!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table tbody>tr,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table tbody>tr{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    width:100%!important;
    min-width:0!important;
    gap:0 12px!important;
    padding:13px!important;
    box-sizing:border-box!important;
    border:1px solid #dfe8ec!important;
    border-radius:14px!important;
    background:linear-gradient(145deg,#fff,#fbfdfe)!important;
    box-shadow:0 6px 18px rgba(18,49,72,.03)!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table td,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    padding:8px 0!important;
    border:0!important;
    border-bottom:1px solid #edf2f4!important;
    background:transparent!important;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:anywhere!important;
    font-size:10.5px!important;
    line-height:1.35!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table td::before,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table td::before{
    display:block!important;
    margin:0 0 4px!important;
    color:#81949f!important;
    font-size:6.8px!important;
    font-weight:900!important;
    line-height:1!important;
    letter-spacing:.06em!important;
    text-transform:uppercase!important;
  }

  /* Current tenancy labels and spans. */
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(1){grid-column:1/-1!important;padding-top:0!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(1)::before{content:"Tenancy"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(2){grid-column:1/-1!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(2)::before{content:"Tenant"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(3){grid-column:1/-1!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(3)::before{content:"Property"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(4){grid-column:1/-1!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(4)::before{content:"Lease"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(5)::before{content:"Rent"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(6)::before{content:"Status"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(5),
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(6){border-bottom:0!important;padding-bottom:0!important}

  /* Completed history labels. */
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(1){grid-column:1/-1!important;padding-top:0!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(1)::before{content:"Tenant"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(2){grid-column:1/-1!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(2)::before{content:"Property"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(3){grid-column:1/-1!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(3)::before{content:"Lease"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(4)::before{content:"Rent Outcome"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(5)::before{content:"Deposit"!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(6){grid-column:1/-1!important;border-bottom:0!important;padding-bottom:0!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td:nth-child(6)::before{content:"Record"!important}

  /* Empty result rows must occupy the full panel — never a tiny left card. */
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table tbody>tr:has(.admin-empty),
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table tbody>tr:has(.admin-empty){
    display:block!important;
    width:100%!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table tbody>tr:has(.admin-empty)>td,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table tbody>tr:has(.admin-empty)>td{
    display:block!important;
    width:100%!important;
    max-width:none!important;
    padding:0!important;
    border:0!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table tbody>tr:has(.admin-empty)>td::before,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table tbody>tr:has(.admin-empty)>td::before{
    display:none!important;
    content:none!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-empty,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .admin-empty{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    width:100%!important;
    min-width:0!important;
    min-height:96px!important;
    margin:0!important;
    padding:18px 18px 18px 66px!important;
    box-sizing:border-box!important;
    border:1px dashed #ccdce3!important;
    border-radius:13px!important;
    background:linear-gradient(135deg,#fbfdfe,#f7fafb)!important;
    text-align:left!important;
    color:#718592!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-empty::before,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .admin-empty::before{
    left:17px!important;
    width:34px!important;
    height:34px!important;
    min-width:34px!important;
    min-height:34px!important;
    border-radius:9px!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) .admin-empty strong,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel .admin-empty strong{
    margin:0!important;
    color:#26485d!important;
    font-size:11.5px!important;
    line-height:1.35!important;
    font-weight:800!important;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:normal!important;
  }

  /* Keep the final panel comfortably above the fixed mobile navigation. */
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]){padding-bottom:8px!important}
}

/* Narrow iPhones: keep 2x2 KPI density instead of expanding to four tall cards. */
@media (max-width:380px){
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-strip{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
  }
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-cell{
    min-height:84px!important;
    padding:11px!important;
  }
  body.theo-admin #content:has(input[data-admin-filter="tenancySearch"]) .admin-summary-cell>strong{font-size:22px!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) table.admin-table tbody>tr,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel table.admin-table tbody>tr{
    grid-template-columns:1fr!important;
  }
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td,
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) + .admin-ops-panel td{grid-column:1!important}
  body.theo-admin #content .admin-ops-panel:has(input[data-admin-filter="tenancySearch"]) td:nth-child(5){border-bottom:1px solid #edf2f4!important;padding-bottom:8px!important}
}
