/* ============================================================
   NEST IN - CUSTOMER LEDGER / RESIDENT 360 V1
   ============================================================ */

#resident360View{
  width:100%;
}

.r360-page{
  display:grid;
  gap:18px;
}

.r360-toolbar{
  display:grid;
  grid-template-columns:minmax(220px,1.4fr) minmax(160px,.8fr) minmax(160px,.8fr) auto;
  gap:12px;
  align-items:end;
}

.r360-toolbar .field{
  margin:0;
}

.r360-stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}

.r360-stat{
  padding:17px;
  border:1px solid var(--line);
  border-radius:17px;
  background:#fff;
}

.r360-stat span{
  display:block;
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.r360-stat strong{
  display:block;
  margin-top:6px;
  font-size:23px;
  color:var(--ink);
}

.r360-table-wrap{
  overflow:auto;
}

.r360-table{
  width:100%;
  min-width:920px;
  border-collapse:collapse;
}

.r360-table th,
.r360-table td{
  padding:12px 10px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:middle;
}

.r360-table th{
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.r360-person{
  display:flex;
  align-items:center;
  gap:11px;
}

.r360-avatar{
  width:39px;
  height:39px;
  flex:0 0 39px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#edf4f1;
  color:#173f37;
  font-weight:900;
}

.r360-person strong{
  display:block;
}

.r360-meta{
  margin-top:2px;
  color:var(--muted);
  font-size:12px;
}

.r360-chip{
  display:inline-flex;
  align-items:center;
  min-height:25px;
  padding:4px 9px;
  border-radius:999px;
  background:#f0f4f2;
  color:#35534b;
  font-size:11px;
  font-weight:800;
}

.r360-chip.active{
  background:#e6f5ee;
  color:#14633f;
}

.r360-chip.warn{
  background:#fff2da;
  color:#8a5b00;
}

.r360-chip.bad{
  background:#fdeaea;
  color:#963b3b;
}

.r360-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
}

#r360Drawer{
  position:fixed;
  inset:0;
  z-index:1200;
  background:rgba(19,32,28,.46);
  display:flex;
  justify-content:flex-end;
}

#r360Drawer.hidden{
  display:none;
}

.r360-drawer{
  width:min(1040px,94vw);
  height:100%;
  overflow:auto;
  background:#f7f9f8;
  box-shadow:-10px 0 38px rgba(0,0,0,.18);
}

.r360-drawer-head{
  position:sticky;
  top:0;
  z-index:5;
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:18px 22px;
  border-bottom:1px solid var(--line);
  background:#fff;
}

.r360-drawer-head h2{
  margin:3px 0 0;
  font-size:25px;
}

.r360-drawer-head p{
  margin:5px 0 0;
  color:var(--muted);
  font-size:12px;
}

.r360-drawer-body{
  padding:18px 22px 40px;
}

.r360-tabs{
  display:flex;
  gap:7px;
  overflow:auto;
  padding-bottom:10px;
  margin-bottom:15px;
}

.r360-tab{
  flex:0 0 auto;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:#49605a;
  padding:8px 12px;
  font:inherit;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.r360-tab.active{
  background:#173f37;
  border-color:#173f37;
  color:#fff;
}

.r360-pane{
  display:none;
}

.r360-pane.active{
  display:block;
}

.r360-summary{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:11px;
  margin-bottom:14px;
}

.r360-summary .r360-stat{
  padding:14px;
}

.r360-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.r360-card{
  padding:17px;
  border:1px solid var(--line);
  border-radius:17px;
  background:#fff;
}

.r360-card h3{
  margin:0 0 13px;
  font-size:16px;
}

.r360-detail-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0 18px;
}

.r360-detail{
  padding:9px 0;
  border-bottom:1px solid #edf0ef;
}

.r360-detail b{
  display:block;
  margin-bottom:3px;
  color:var(--muted);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.r360-entry{
  display:grid;
  grid-template-columns:105px minmax(0,1fr) 125px;
  gap:12px;
  align-items:start;
  padding:11px 0;
  border-bottom:1px solid #edf0ef;
}

.r360-entry:last-child{
  border-bottom:0;
}

.r360-entry .amount{
  text-align:right;
  font-weight:800;
}

.r360-positive{
  color:#1f7455;
}

.r360-negative{
  color:#a24242;
}

.r360-receipt,
.r360-followup,
.r360-document,
.r360-audit{
  padding:13px 0;
  border-bottom:1px solid #edf0ef;
}

.r360-receipt:last-child,
.r360-followup:last-child,
.r360-document:last-child,
.r360-audit:last-child{
  border-bottom:0;
}

.r360-form{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:11px;
}

.r360-form .full{
  grid-column:1 / -1;
}

.r360-form label{
  display:block;
  margin-bottom:5px;
  color:var(--muted);
  font-size:11px;
  font-weight:800;
}

.r360-form input,
.r360-form select,
.r360-form textarea{
  width:100%;
}

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

.r360-note{
  padding:12px 14px;
  border-radius:13px;
  background:#eef4f1;
  color:#3f5750;
  font-size:12px;
  line-height:1.5;
}

.r360-empty{
  padding:24px;
  text-align:center;
  color:var(--muted);
}

.r360-loading{
  padding:40px;
  text-align:center;
  color:var(--muted);
}

.r360-error{
  padding:13px;
  border-radius:12px;
  background:#fdeaea;
  color:#8f3232;
}

.r360-doc-status{
  margin-left:5px;
}

@media(max-width:900px){
  .r360-toolbar{
    grid-template-columns:1fr 1fr;
  }

  .r360-stats,
  .r360-summary{
    grid-template-columns:1fr 1fr;
  }
}

@media(max-width:620px){
  .r360-toolbar,
  .r360-stats,
  .r360-summary,
  .r360-grid,
  .r360-detail-grid,
  .r360-form{
    grid-template-columns:1fr;
  }

  .r360-form .full{
    grid-column:auto;
  }

  .r360-drawer{
    width:100%;
  }

  .r360-drawer-head{
    padding:15px;
  }

  .r360-drawer-body{
    padding:14px 15px 30px;
  }

  .r360-entry{
    grid-template-columns:80px 1fr;
  }

  .r360-entry .amount{
    grid-column:2;
    text-align:left;
  }
}

/* ============================================================
   RESIDENT360_MENU_POLISH_V1
   ============================================================ */

#opsSidebar .ops-nav button[data-r360-nav] .ops-nav-icon svg{
  width:20px;
  height:20px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}


/*
 * Desktop:
 * fit all Resident 360 tabs on one clean row.
 */
@media (min-width:1101px){

  .r360-tabs{
    display:grid;
    grid-template-columns:
      repeat(10,minmax(0,max-content));
    justify-content:space-between;
    align-items:center;
    gap:5px;
    overflow:visible;
    padding:0 0 9px;
    margin-bottom:15px;
  }

  .r360-tab{
    min-width:0;
    flex:none;
    white-space:nowrap;
    padding:7px 9px;
    font-size:11px;
    line-height:1.2;
  }

}


/*
 * Tablet / smaller screens:
 * retain touch-friendly horizontal scrolling.
 */
@media (max-width:1100px){

  .r360-tabs{
    display:flex;
    gap:7px;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:thin;
    padding-bottom:8px;
  }

  .r360-tab{
    flex:0 0 auto;
    white-space:nowrap;
  }

}



/* ============================================================
   NESTIN_GUEST360_RIGHT_HOVER_RAIL_V1
   Scrollable Guest / Resident 360 with right hover navigation.
   Existing pane logic and accounting remain unchanged.
   ============================================================ */

@media (min-width:901px){

  .r360-drawer{
    display:flex;
    flex-direction:column;
    max-height:94dvh;
    overflow:hidden;
  }

  .r360-drawer-head{
    flex:0 0 auto;
    position:relative;
    z-index:8;
  }

  .r360-drawer-body{
    flex:1 1 auto;
    min-height:0;

    display:grid;
    grid-template-columns:
      minmax(0,1fr)
      54px;

    grid-template-rows:
      minmax(min-content,auto);

    column-gap:14px;

    overflow-y:auto;
    overflow-x:hidden;

    overscroll-behavior:contain;
    scrollbar-gutter:stable;

    padding-right:14px;
  }


  /*
   * All content panes share the left content column.
   * Only the existing active pane remains visible.
   */

  .r360-drawer-body > .r360-pane{
    grid-column:1;
    grid-row:1;
    min-width:0;
  }


  /*
   * Right navigation rail.
   */

  .r360-drawer-body > .r360-tabs{
    grid-column:2;
    grid-row:1;

    position:sticky;
    top:8px;

    align-self:start;
    justify-self:end;

    z-index:10;

    display:flex;
    flex-direction:column;

    width:46px;
    max-height:calc(100dvh - 150px);

    gap:5px;

    margin:0;
    padding:6px;

    overflow-x:hidden;
    overflow-y:auto;

    border:1px solid #dce6e2;
    border-radius:16px;

    background:
      rgba(255,255,255,.96);

    box-shadow:
      0 10px 28px
      rgba(27,56,49,.12);

    transition:
      width .18s ease,
      box-shadow .18s ease;
  }


  .r360-drawer-body > .r360-tabs:hover,
  .r360-drawer-body > .r360-tabs:focus-within{
    width:174px;

    box-shadow:
      0 14px 34px
      rgba(27,56,49,.18);
  }


  /*
   * Compact icon-first buttons.
   */

  .r360-tabs .r360-tab{
    position:relative;

    display:flex;
    align-items:center;

    width:34px;
    min-height:36px;

    padding:7px 9px;

    overflow:hidden;

    border-radius:10px;

    white-space:nowrap;
    text-align:left;

    font-size:0;

    transition:
      width .18s ease,
      background .18s ease,
      color .18s ease;
  }


  .r360-tabs:hover .r360-tab,
  .r360-tabs:focus-within .r360-tab{
    width:160px;
    font-size:11px;
  }


  .r360-tab::before{
    flex:0 0 18px;

    width:18px;
    margin-right:8px;

    text-align:center;

    font-size:14px;
    line-height:1;

    color:currentColor;
  }


  /*
   * Right-rail symbols mapped to the existing ten panes.
   */

  .r360-tab:nth-child(1)::before{
    content:"◉";
  }

  .r360-tab:nth-child(2)::before{
    content:"♙";
  }

  .r360-tab:nth-child(3)::before{
    content:"⌂";
  }

  .r360-tab:nth-child(4)::before{
    content:"₹";
  }

  .r360-tab:nth-child(5)::before{
    content:"⇄";
  }

  .r360-tab:nth-child(6)::before{
    content:"◇";
  }

  .r360-tab:nth-child(7)::before{
    content:"▤";
  }

  .r360-tab:nth-child(8)::before{
    content:"≡";
  }

  .r360-tab:nth-child(9)::before{
    content:"✓";
  }

  .r360-tab:nth-child(10)::before{
    content:"◷";
  }


  .r360-tabs .r360-tab.active{
    background:#173f37;
    border-color:#173f37;
    color:#fff;
  }


  /*
   * Give active Guest 360 content comfortable scrolling room.
   */

  .r360-pane.active{
    padding-right:2px;
    padding-bottom:28px;
  }

}


/* ============================================================
   TOUCH / MOBILE FALLBACK
   No hover-only controls on touch sized layouts.
   ============================================================ */

@media (max-width:900px){

  .r360-drawer{
    display:flex;
    flex-direction:column;
    max-height:100dvh;
    overflow:hidden;
  }

  .r360-drawer-body{
    display:block;

    flex:1 1 auto;
    min-height:0;

    overflow-y:auto;
    overflow-x:hidden;

    overscroll-behavior:contain;
  }

  .r360-tabs{
    position:sticky;
    top:0;
    z-index:6;

    display:flex;
    flex-direction:row;

    width:auto;

    gap:7px;

    overflow-x:auto;
    overflow-y:hidden;

    padding:8px 0 10px;
    margin-bottom:12px;

    background:#fff;
  }

  .r360-tab{
    flex:0 0 auto;

    width:auto;

    font-size:12px;

    white-space:nowrap;
  }

  .r360-tab::before{
    content:none !important;
  }

}


/* ============================================================
   NESTIN_GUEST360_FINAL_POLISH_V2
   Wider hover rail and clearer desktop interaction.
   Existing panes and accounting remain unchanged.
   ============================================================ */

@media (min-width:901px){

  .r360-drawer-body > .r360-tabs:hover,
  .r360-drawer-body > .r360-tabs:focus-within{
    width:198px;
    border-color:#c7d8d1;

    box-shadow:
      0 16px 36px
      rgba(27,56,49,.18);
  }

  .r360-tabs:hover .r360-tab,
  .r360-tabs:focus-within .r360-tab{
    width:184px;
  }

  .r360-tabs .r360-tab{
    min-height:38px;
  }

  .r360-tabs .r360-tab.active{
    box-shadow:
      0 4px 12px
      rgba(23,63,55,.16);
  }

  .r360-tabs .r360-tab:not(.active):hover{
    background:#f2f7f5;
    border-color:#cadbd5;
    color:#173f37;
  }

}


/* ============================================================
   NESTIN_CUSTOMER_LEDGER_UI_POLISH_V1
   Customer Ledger / Resident 360 list presentation only.
   ============================================================ */

#resident360View .r360-page{
  gap:14px;
}


/* ------------------------------------------------------------
   FILTER BAR
   ------------------------------------------------------------ */

#resident360View .r360-toolbar{
  padding:16px;
  border:1px solid #dfe8e4;
  border-radius:18px;
  background:#fff;
  box-shadow:
    0 7px 24px
    rgba(24,52,45,.055);

  grid-template-columns:
    minmax(260px,1.5fr)
    minmax(190px,.85fr)
    minmax(190px,.85fr)
    auto;

  gap:10px;
}

#resident360View .r360-toolbar label{
  display:block;
  margin-bottom:6px;
  color:#354d47;
  font-size:11px;
  font-weight:800;
}

#resident360View .r360-toolbar input,
#resident360View .r360-toolbar select{
  min-height:43px;
  border-radius:11px;
}

#resident360View .r360-toolbar .btn{
  min-height:43px;
  padding-left:18px;
  padding-right:18px;
  border-radius:11px;
}


/* ------------------------------------------------------------
   KPI STRIP
   ------------------------------------------------------------ */

#resident360View .r360-stats{
  gap:10px;
}

#resident360View .r360-stat{
  position:relative;
  min-height:88px;
  padding:14px 16px;

  border-radius:16px;
  border-color:#dde7e3;

  box-shadow:
    0 4px 16px
    rgba(24,52,45,.035);

  overflow:hidden;
}

#resident360View .r360-stat::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:3px;
  background:
    linear-gradient(
      90deg,
      #174f45,
      #81a32a
    );
  opacity:.82;
}

#resident360View .r360-stat span{
  font-size:10px;
  letter-spacing:.055em;
}

#resident360View .r360-stat strong{
  margin-top:5px;
  font-size:21px;
  line-height:1.15;
}


/* ------------------------------------------------------------
   RESIDENT TABLE
   ------------------------------------------------------------ */

#resident360View .r360-table-wrap{
  overflow:auto;

  border:1px solid #dde6e2;
  border-radius:18px;

  background:#fff;

  box-shadow:
    0 8px 28px
    rgba(24,52,45,.05);
}

#resident360View .r360-table{
  min-width:1000px;
}

#resident360View .r360-table th{
  position:sticky;
  top:0;
  z-index:2;

  padding:11px 12px;

  background:#f4f7f6;
  color:#4d625d;

  font-size:10px;
  font-weight:900;
}

#resident360View .r360-table td{
  padding:10px 12px;
}

#resident360View .r360-table tbody tr{
  transition:
    background .14s ease,
    box-shadow .14s ease;
}

#resident360View .r360-table tbody tr:hover{
  background:#f8fbfa;
}

#resident360View .r360-table tbody tr:last-child td{
  border-bottom:0;
}


/* ------------------------------------------------------------
   RESIDENT IDENTITY
   ------------------------------------------------------------ */

#resident360View .r360-person{
  gap:10px;
}

#resident360View .r360-avatar{
  width:36px;
  height:36px;
  flex-basis:36px;

  border:1px solid #dce9e4;

  font-size:12px;
}

#resident360View .r360-person strong{
  color:#102c27;
  font-size:13px;
  line-height:1.25;
}

#resident360View .r360-meta{
  margin-top:3px;
  font-size:10.5px;
  line-height:1.3;
}


/* ------------------------------------------------------------
   MONEY COLUMNS
   ------------------------------------------------------------ */

#resident360View .r360-table th:nth-child(4),
#resident360View .r360-table th:nth-child(5),
#resident360View .r360-table td:nth-child(4),
#resident360View .r360-table td:nth-child(5){
  text-align:right;
}

#resident360View .r360-table td:nth-child(4),
#resident360View .r360-table td:nth-child(5){
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}

#resident360View .r360-negative strong{
  color:#a33131;
}

#resident360View .r360-positive strong{
  color:#176346;
}


/* ------------------------------------------------------------
   STATUS / FOLLOW-UP
   ------------------------------------------------------------ */

#resident360View .r360-chip{
  min-height:23px;
  padding:3px 8px;
  font-size:10px;
}


/* ------------------------------------------------------------
   ACTIONS
   ------------------------------------------------------------ */

#resident360View .r360-actions{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:6px;
}

#resident360View .r360-actions .btn{
  min-height:36px;
  padding:8px 12px;

  border-radius:10px;

  white-space:nowrap;

  font-size:11px;
  font-weight:800;
}

#resident360View .r360-actions .btn-primary{
  box-shadow:
    0 5px 13px
    rgba(42,80,211,.14);
}


/* ------------------------------------------------------------
   COLUMN SIZING
   ------------------------------------------------------------ */

@media (min-width:1101px){

  #resident360View .r360-table th:nth-child(1){
    width:21%;
  }

  #resident360View .r360-table th:nth-child(2){
    width:27%;
  }

  #resident360View .r360-table th:nth-child(3){
    width:10%;
  }

  #resident360View .r360-table th:nth-child(4){
    width:10%;
  }

  #resident360View .r360-table th:nth-child(5){
    width:11%;
  }

  #resident360View .r360-table th:nth-child(6){
    width:9%;
  }

  #resident360View .r360-table th:nth-child(7){
    width:12%;
  }

}


/* ------------------------------------------------------------
   TABLET
   ------------------------------------------------------------ */

@media (max-width:1100px){

  #resident360View .r360-toolbar{
    grid-template-columns:
      minmax(240px,1fr)
      minmax(170px,.7fr);
  }

  #resident360View .r360-stats{
    grid-template-columns:
      repeat(2,minmax(0,1fr));
  }

}


/* ------------------------------------------------------------
   MOBILE
   ------------------------------------------------------------ */

@media (max-width:700px){

  #resident360View .r360-page{
    gap:11px;
  }

  #resident360View .r360-toolbar{
    grid-template-columns:1fr;
    padding:12px;
    border-radius:15px;
  }

  #resident360View .r360-stats{
    grid-template-columns:
      repeat(2,minmax(0,1fr));
    gap:8px;
  }

  #resident360View .r360-stat{
    min-height:78px;
    padding:12px;
  }

  #resident360View .r360-stat strong{
    font-size:18px;
  }

  #resident360View .r360-table-wrap{
    border-radius:14px;
  }

  #resident360View .r360-actions{
    flex-direction:column;
    align-items:stretch;
  }

  #resident360View .r360-actions .btn{
    width:100%;
  }

}
