/* AIO SubTable (front) - kintone-like theme */
.aio-kcms-subtable-wrap{margin:10px 0; overflow-x:auto; max-width:100%; position:relative; padding-bottom:18px;}
.aio-kcms-subtable-title{font-weight:600;margin:0 0 6px 0;}

.aio-kcms-subtable-table{border-collapse:separate;border-spacing:0;width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}
.aio-kcms-subtable-table thead th{
  background:#2f80c1; /* kintone-ish blue */
  color:#fff;
  font-weight:600;
  padding:10px 8px;
  border-right:1px solid rgba(255,255,255,.25);
  font-size:14px;
}
.aio-kcms-subtable-table thead th:first-child{border-top-left-radius:3px;}
.aio-kcms-subtable-table thead th:last-child{border-top-right-radius:3px;border-right:none;}

.aio-kcms-subtable-table tbody td{
  background:#fff;
  border-right:1px solid #d7d7d7;
  border-bottom:1px solid #d7d7d7;
  padding:8px;
  vertical-align:top;
}
.aio-kcms-subtable-table tbody tr td:first-child{border-left:1px solid #d7d7d7;}
.aio-kcms-subtable-table tbody tr:first-child td{border-top:1px solid #d7d7d7;}

.aio-kcms-subtable-table input[type="text"],
.aio-kcms-subtable-table input[type="date"],
.aio-kcms-subtable-table input[type="time"],
.aio-kcms-subtable-table input[type="datetime-local"],
.aio-kcms-subtable-table input[type="number"],
.aio-kcms-subtable-table input[type="email"],
.aio-kcms-subtable-table input[type="tel"],
.aio-kcms-subtable-table input[type="url"],
.aio-kcms-subtable-table textarea,
.aio-kcms-subtable-table select{
  width:100%;
  box-sizing:border-box;
  padding:8px 10px;
  border:1px solid #c9c9c9;
  border-radius:2px;
  background:#fff;
}
.aio-kcms-subtable-table textarea{min-height:68px;resize:vertical;}

/* Row actions column (sticky right) */
.aio-kcms-subtable-actions{width:56px;text-align:center;position:sticky;right:0;background:#fff;z-index:5;}
.aio-kcms-subtable-actions{box-shadow:-6px 0 8px rgba(0,0,0,.05);}

.aio-kcms-roundbtn{
  width:34px;height:34px;border-radius:50%;
  display:inline-flex;align-items:center;justify-content:center;
  border:2px solid currentColor;background:#fff;
  cursor:pointer;user-select:none;
}
.aio-kcms-roundbtn.is-add{color:#2271b1;}
.aio-kcms-roundbtn.is-del{color:#8c8f94;}
.aio-kcms-roundbtn:disabled{opacity:.35;cursor:not-allowed;}

/* USER_SELECT (chips) */
.aio-kcms-userselect{display:flex;gap:6px;align-items:center;}
.aio-kcms-userselect-input{flex:1;min-width:0;}
.aio-kcms-userselect-btn{
  width:34px;height:34px;border:1px solid #c9c9c9;border-radius:2px;
  background:#fff;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;
}
.aio-kcms-userselect-btn:hover{background:#f5f5f5;}
.aio-kcms-userselect-chips{margin-top:6px;display:flex;flex-wrap:wrap;gap:6px;}
.aio-kcms-chip{background:#eef3f8;border:1px solid #c9d6e4;border-radius:14px;padding:4px 10px;font-size:12px;display:inline-flex;gap:6px;align-items:center;}
.aio-kcms-chip button{border:none;background:transparent;cursor:pointer;font-size:14px;line-height:1;color:#666;}

/* Simple dropdown */
.aio-kcms-userselect-dropdown{position:absolute;z-index:9999;background:#fff;border:1px solid #c9c9c9;border-radius:2px;max-height:240px;overflow:auto;min-width:220px;box-shadow:0 6px 18px rgba(0,0,0,.12);}
.aio-kcms-userselect-item{padding:8px 10px;cursor:pointer;}
.aio-kcms-userselect-item:hover{background:#f2f7fb;}


/* Prevent header/title from stacking vertically on narrow widths */
.aio-kcms-subtable-title{white-space:nowrap; writing-mode:horizontal-tb;}
.aio-kcms-subtable-table thead th{white-space:nowrap; word-break:keep-all;}


.aio-kcms-field-subtable{margin:10px 0;}

.aio-kcms-subtable-title{margin:0 0 6px 0;font-weight:600;white-space:nowrap;}
.aio-kcms-subtable-table thead th{white-space:nowrap;word-break:keep-all;}

.aio-kcms-user-select{min-width:220px;}

.aio-kcms-field-error{outline:2px solid #ef4444; outline-offset:2px; border-radius:6px;}

.aio-kcms-error-tip{margin-top:6px;color:#b91c1c;font-size:12px;}


/* Floating +/- for subtable when left actions are hidden by horizontal scroll */
#aio-kcms-float-st-actions{position:fixed; right:12px; z-index:99999; display:none; background:rgba(255,255,255,.95); border:1px solid #d0d0d0; border-radius:10px; padding:6px; box-shadow:0 6px 18px rgba(0,0,0,.15); gap:6px; align-items:center; justify-content:center; flex-direction:column;}
#aio-kcms-float-st-actions .aio-kcms-roundbtn{width:34px;height:34px;border-radius:50%;}

/* keep subtable +/- visible during horizontal scroll */
.aio-kcms-subtable-table th.aio-kcms-subtable-actions,
.aio-kcms-subtable-table td.aio-kcms-subtable-actions{
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 20;
}
.aio-kcms-subtable-table th.aio-kcms-subtable-actions{ z-index: 30; }

/* keep subtable +/- always visible like kintone */
.aio-kcms-subtable-actions{position:sticky; right:0; z-index:5; background:rgba(255,255,255,0.96); border-left:1px solid rgba(0,0,0,0.06);} 


/* Fixed actions overlay (front) */
.aio-kcms-subtable-wrap.aio-kcms-fixed-actions-ready .aio-kcms-subtable-actions{visibility:hidden;} /* hide originals only after overlay is ready */
.aio-kcms-st-fixed-actions{display:block; position:absolute; top:0; right:0; width:56px; z-index:20;}
.aio-kcms-st-fixed-actions-table{pointer-events:auto;}
.aio-kcms-st-fixed-cell{background:#fff; text-align:center; vertical-align:middle; border-left:1px solid #e5e5e5; box-shadow:-6px 0 8px rgba(0,0,0,.05);}
.aio-kcms-st-fixed-cell .aio-kcms-roundbtn{width:34px;height:34px;border-radius:50%;}


.aio-kcms-st-shell{position:relative; max-width:100%; padding-right:56px;}
.aio-kcms-st-shell .aio-kcms-subtable-wrap{max-width:100%;}


.aio-kcms-st-shell{position:relative; max-width:100%;}
.aio-kcms-st-shell .aio-kcms-subtable-wrap{max-width:100%;}
.aio-kcms-st-fixed-actions{display:block; position:absolute; top:0; right:0; width:56px; z-index:20;}
.aio-kcms-st-fixed-actions-table{width:56px; border-collapse:separate; border-spacing:0;}
.aio-kcms-st-fixed-cell{background:#fff; text-align:center; vertical-align:middle; border-left:1px solid #e5e5e5; box-shadow:-6px 0 8px rgba(0,0,0,.05);}
.aio-kcms-st-fixed-cell .aio-kcms-roundbtn{width:34px;height:34px;border-radius:50%;}
.aio-kcms-st-shell.aio-kcms-st-fixed-ready .aio-kcms-subtable-actions{display:none !important;}


/* Front subtable fixed right actions rail */
.aio-kcms-st-shell{
  display:grid;
  grid-template-columns:minmax(0,1fr) 56px;
  align-items:start;
  max-width:100%;
  position:relative;
}
.aio-kcms-st-shell .aio-kcms-subtable-wrap{
  min-width:0;
  max-width:100%;
}
.aio-kcms-st-fixed-actions{
  width:56px;
  display:block;
  position:sticky;
  right:0;
  top:0;
  z-index:20;
  background:#fff;
}
.aio-kcms-st-fixed-head{
  background:#2f80c1;
  border-left:1px solid rgba(255,255,255,.25);
}
.aio-kcms-st-fixed-row{
  background:#fff;
  border-left:1px solid #d7d7d7;
  border-bottom:1px solid #d7d7d7;
  box-shadow:-6px 0 8px rgba(0,0,0,.05);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}
.aio-kcms-st-fixed-row .aio-kcms-roundbtn{
  width:34px;
  height:34px;
  border-radius:50%;
}
.aio-kcms-subtable-actions-hidden{
  width:0 !important;
  min-width:0 !important;
  max-width:0 !important;
  padding:0 !important;
  border:none !important;
  overflow:hidden !important;
  visibility:hidden !important;
}


/* v2.4.17: align fixed action rail with subtable header line */
.aio-kcms-st-shell{
  align-items:start;
}
.aio-kcms-st-fixed-actions{
  margin-top:0 !important;
}
.aio-kcms-st-fixed-head{
  box-sizing:border-box;
  border-top:1px solid rgba(255,255,255,.25);
  border-bottom:1px solid #d7d7d7;
}
.aio-kcms-st-fixed-row:first-of-type{
  border-top:none;
}
.aio-kcms-st-fixed-actions,
.aio-kcms-st-fixed-head,
.aio-kcms-st-fixed-row{
  box-sizing:border-box;
}


/* v2.4.18: force fixed action rail top alignment */
.aio-kcms-st-shell{
  display:grid;
  grid-template-columns:minmax(0,1fr) 56px;
  column-gap:0 !important;
  align-items:start !important;
}

.aio-kcms-st-shell > .aio-kcms-subtable-wrap,
.aio-kcms-st-shell > .aio-kcms-st-fixed-actions{
  margin-top:0 !important;
  padding-top:0 !important;
  align-self:start !important;
}

.aio-kcms-st-fixed-actions{
  top:0 !important;
  right:0 !important;
}

.aio-kcms-st-fixed-head{
  margin:0 !important;
  padding:0 !important;
  box-sizing:border-box !important;
  border-top:none !important;
  border-bottom:none !important;
}


.aio-kcms-error-summary{
  margin:0 0 14px 0;
  padding:10px 12px;
  border:1px solid #ef4444;
  background:#fff5f5;
  color:#991b1b;
  border-radius:6px;
}
.aio-kcms-error-summary ul{
  margin:0;
  padding-left:18px;
}


.aio-kcms-error-summary-title{
  font-weight:700;
  margin-bottom:6px;
}
.aio-kcms-error-summary li{
  margin:2px 0;
}
