/* ROYA GLOBAL TABLE ENGINE - SAFE V1
   Presentation only: column visibility + resize controls. */
.roya-table-toolbar{
  position:relative;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  margin:6px 0 8px;
  direction:rtl;
  font-family:Tahoma,"Segoe UI",sans-serif;
}
.roya-table-settings{
  position:relative;
  text-align:left;
}
.roya-table-settings>summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid #dfe3eb;
  border-radius:9px;
  background:#fff;
  color:#651b5c;
  padding:7px 11px;
  font-size:13px;
  font-weight:700;
  line-height:1.4;
  box-shadow:0 2px 8px #27314d0a;
}
.roya-table-settings>summary::-webkit-details-marker{display:none}
.roya-table-settings[open]>summary{background:#f7f1f6}
.roya-table-menu{
  position:relative;
  left:auto;
  top:auto;
  z-index:50;
  margin-top:6px;
  width:min(320px,calc(100vw - 36px));
  max-height:440px;
  overflow:auto;
  background:#fff;
  border:1px solid #dfe3eb;
  border-radius:12px;
  padding:12px;
  box-shadow:0 16px 38px #1d24332a;
  color:#1d2433;
  text-align:right;
}
.roya-table-menu-title{
  font-size:13px;
  font-weight:800;
  margin:0 0 8px;
}
.roya-table-column-list{
  display:grid;
  gap:5px;
}
.roya-table-column-option{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 7px;
  border-radius:7px;
  font-size:13px;
  line-height:1.5;
  cursor:pointer;
}
.roya-table-column-option:hover{background:#f7f8fb}
.roya-table-column-option input{
  min-width:0!important;
  width:16px!important;
  height:16px;
  margin:0;
  padding:0;
  flex:0 0 auto;
}
.roya-table-menu-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid #e7eaf1;
}
.roya-table-menu-actions button{
  border:0;
  border-radius:8px;
  padding:7px 10px;
  cursor:pointer;
  font:700 12px Tahoma,"Segoe UI",sans-serif;
  background:#eee9ee;
  color:#651b5c;
}
.roya-table-menu-note{
  display:block;
  margin-top:9px;
  color:#687185;
  font-size:11px;
  line-height:1.6;
}
table.roya-table-enhanced{
  table-layout:fixed;
}
table.roya-table-enhanced th,
table.roya-table-enhanced td{
  box-sizing:border-box;
}
table.roya-table-enhanced th.roya-resizable-head{
  position:relative;
}
.roya-col-resizer{
  position:absolute;
  top:0;
  bottom:0;
  width:10px;
  z-index:6;
  cursor:col-resize;
  touch-action:none;
  user-select:none;
}
[dir="rtl"] .roya-col-resizer{left:-5px}
[dir="ltr"] .roya-col-resizer{right:-5px}
.roya-col-resizer::after{
  content:"";
  position:absolute;
  top:18%;
  bottom:18%;
  width:2px;
  border-radius:2px;
  background:transparent;
}
[dir="rtl"] .roya-col-resizer::after{left:4px}
[dir="ltr"] .roya-col-resizer::after{right:4px}
.roya-col-resizer:hover::after,
.roya-col-resizer.roya-resizing::after{
  background:#872b77;
}
body.roya-table-resizing{
  cursor:col-resize!important;
  user-select:none!important;
}
.roya-table-engine-hidden{
  display:none!important;
}
@media(max-width:700px){
  .roya-table-toolbar{margin-top:5px}
  .roya-table-settings>summary{padding:7px 10px;font-size:12px}
  .roya-table-menu{max-height:65vh}
}

/* ROYA GLOBAL TABLE ENGINE - SAFE V2
   Resize visual fix:
   when a column is made narrower, its content is clipped inside that cell
   instead of visually spilling over adjacent columns. */
table.roya-table-enhanced th,
table.roya-table-enhanced td{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Let common content shrink inside resized cells instead of forcing the column open. */
table.roya-table-enhanced th > *,
table.roya-table-enhanced td > *{
  max-width:100%;
}

/* Keep forms and action rows contained by the resized cell. */
table.roya-table-enhanced td form,
table.roya-table-enhanced td .inline-actions{
  min-width:0!important;
  max-width:100%;
  overflow:hidden;
}

/* Inputs/selects/buttons may have global minimum widths elsewhere in the CRM.
   Inside a manually resized table cell they must respect the chosen column width. */
table.roya-table-enhanced td input,
table.roya-table-enhanced td select,
table.roya-table-enhanced td button,
table.roya-table-enhanced td .button{
  min-width:0!important;
  max-width:100%;
}

/* Images must stay inside a narrowed column. */
table.roya-table-enhanced td img{
  max-width:100%;
}


/* ROYA GLOBAL TABLE UX SAFE V1
   Consistent readable widths, persistent visibility and quick search. */
.roya-table-toolbar{
  flex-wrap:wrap;
  min-height:42px;
}
.roya-table-quick-search{
  display:flex;
  align-items:center;
  margin-inline-end:auto;
  min-width:min(290px,100%);
}
.roya-table-quick-search input{
  width:min(300px,100%);
  min-width:180px!important;
  padding:8px 11px;
  border:1px solid #dfe3eb;
  border-radius:9px;
  background:#fff;
  font:600 13px Tahoma,"Segoe UI",sans-serif;
  color:#1d2433;
}
.roya-table-search-hidden{
  display:none!important;
}
.table-wrap:has(> table.roya-table-enhanced),
.scroll:has(> table.roya-table-enhanced){
  overflow-x:auto;
  overflow-y:auto;
  scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
  max-width:100%;
}
table.roya-table-enhanced{
  width:100%;
  max-width:none;
}
table.roya-table-enhanced th,
table.roya-table-enhanced td{
  min-width:72px;
}
@media(max-width:700px){
  .roya-table-quick-search{order:3;flex:1 0 100%;min-width:0}
  .roya-table-quick-search input{width:100%}
}
